第一次打cf,确实有很多不适应的地方,第一题上来把$n$和$m$看反了,然后特判的时候写的是$M % N$,直接wa到飞
Educational Codeforces Round 98 (Rated for Div. 2) A.
当先手发完球耐力值变成0的时候,后手选择回击球,因为此时先手无法反击。那么先手就少赢一轮,且后手每一轮都能赢。
时刻,机器人处于静止,那么他会执行这条命令,否则会继续执行前一条命令。对于每一条命令
$f[i][j][sta]$表示到第$i$列,有$j$个连通块的方案,当前列的状态为$sta$,就是“白白” “白黑”“黑白”“黑黑”这四种状态
B. Infinite Prefixes 无限前缀 You are given string ? of length ? consisting of 0-s and 1-s. You build an
A 水题 #include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n,m; cin>>n>>m; if(n % m==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } } B 水题 #include<bits/stdc++.h> using namespace std; int a[105]; int main()
D和E在补了,在补了。。。 ---- A. Password ---- Origional Link 题目大意: 给定 n 个 0\sim 9 之间不能使用的数字,保证剩余的数大于 2。 任意两个数子组合,每个数字可使用两次,组成一个四位密码。 求在剩余的可选数字中,能组成的密码数量。 ---- 思想: 签到题。 任意两个数字可组成的密码数量固定为 6。 则总数量为剩余数字中的两两组合的数量乘 6。 即设剩余的数的数量为 x = 10 - n,总密码数为 \frac{x\times (x - 1)}{2}.
You are given n switches and m lamps. The i-th switch turns on some subset of the lamps. This information is given as the matrix aconsisting of n rows and m columns where ai, j = 1 if the i-th switch turns on the j-th lamp and ai, j = 0 if the i-th switch is not connected to the j-th lamp.
题意:当前在看书的第 x 页,每次可以向前或者向后翻 d 页,这个书一共 n 页,问能否用最小操作翻到第 y 页。 题解:三种情况:1、直接翻能到的一定最短。 2、先翻到第一页,然后往后翻,翻到第 y 页。3、先翻到第 n 页,然后往前翻,翻到第 y 页。 #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int ans,t,n,x,y,d; cin >> t; while(
A. Equator(模拟) 找权值的中位数,直接模拟。。 代码写的好丑qwq。。 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; const int MAXN = 1e6 + 10; inline int read() { char c = getchar(); int x = 0, f = 1; while(c < '0' || c > '9') {if
思路:我的思路是记录每个1出现的位置,然后在进行遍历得到每相邻的1之间的距离。然后都加起来输出就行了
D. Array Division time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive par
---- A. Three Doors ---- 原题链接 Origional Link ---- 思想 从拿到钥匙的门开始,用其得到的钥匙遍历对应的门 直到钥匙为0,若共打开了3道门,则为YES ---- 代码 #include <bits/stdc++.h> using namespace std; const int N = 10; void solve(){ int a[N]; int n; cin >> n; int flag = 1; //记录打开的
rank是能够通知到的人的个数,比较当前这两个人谁能通知到的人较少,然后把能通知到的人较少的那个人的指向pre[a]指向b(假设a能通知到的人较少),这样是为了减少最后那个for循环的操作,因为你之前把一些不联通的几个子图连到了一起,然而每一个子图里的非根节点的pre还未改变,你需要最后再把它们的指向改一遍。你每次联通的时候都是把人较少的联通到人较多的,最后for循环里改变的次数较少。不过你不比较的话也一样,最后都会指向一个人。
首先规定一个木棍和一个木炭可以组合成一个火把,再给出两种操作,操作一是可以用一根木棍去换根木棍,操作二是可以用根木棍去换一个木炭,初始时有一根木棍,问最少进行多少次操作可以得到个火把(组成火把的过程不花费操作次数,换句话说,只要有至少个木棍和个木炭即可达成目标)。
求$gcd(a, m) = gcd(a+x, m), 0 <= x < m, 1 <= a < m <= 10^{10}$的$x$的个数
You are given string s of length nn consisting of 0-s and 1-s. You build an infinite string t as a concatenation of an infinite number of strings s, or t=ssss…t=ssss… For example, if s= 10010, then t= 100101001010010...
You have a large electronic screen which can display up to 998244353998244353 decimal digits. The digits are displayed in the same way as on different electronic alarm clocks: each place for a digit consists of 77 segments which can be turned on and off to compose different digits. The following picture describes how you can display all 1010 decimal digits: