Codeforces Round #584 B. Koala and Lights】的更多相关文章

链接: https://codeforces.com/contest/1209/problem/B 题意: It is a holiday season, and Koala is decorating his house with cool lights! He owns n lights, all of which flash periodically. After taking a quick glance at them, Koala realizes that each of his…
传送门 A. Paint the Numbers 签到. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 105; int n; int a[N]; bool used[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; for(int i = 1; i <= n; i…
怎么老是垫底啊. 不高兴. 似乎 A 掉一道题总比别人慢一些. A. Paint the Numbers 贪心,从小到大枚举,如果没有被涂色,就新增一个颜色把自己和倍数都涂上. #include<bits/stdc++.h> #define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to) #define dbg(...) fprintf(stderr, __VA_ARGS__) #define F…
Lights Out time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Lenny is playing a game on a 3 × 3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the l…
链接: https://codeforces.com/contest/1209/problem/E2 题意: This is a harder version of the problem. The difference is only in constraints. You are given a rectangular n×m matrix a. In one move you can choose any column and cyclically shift elements in th…
链接: https://codeforces.com/contest/1209/problem/D 题意: The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks!…
链接: https://codeforces.com/contest/1209/problem/C 题意: You are given a sequence of n digits d1d2-dn. You need to paint all the digits in two colors so that: each digit is painted either in the color 1 or in the color 2; if you write in a row from left…
链接: https://codeforces.com/contest/1209/problem/A 题意: You are given a sequence of integers a1,a2,-,an. You need to paint elements in colors, so that: If we consider any color, all elements of this color must be divisible by the minimal element of thi…
-- A,B 先秒切,C 是个毒瘤细节题,浪费了很多时间后终于过了. D 本来是个 sb 题,然而还是想了很久,不过幸好没什么大事. E1,看了一会就会了,然而被细节坑死,好久才过. 感觉 E2 很可做,一直想 E2,结果想了大半了就最后一点没想出来. 此时 G1 更多人做了.然而我不会啊-- 没救了.掉分掉惨了. A 排个序,如果前面有它的约数就染成同色,否则开个新颜色. 下面这个代码,因为刚开始以为要输出方案,所以比较丑. #include<bits/stdc++.h> using nam…
Contest Page A sol 每次选最小的,然后把它的所有倍数都删掉. #include<bits/stdc++.h> using namespace std; int read(){ int a = 0; char c = getchar(); bool f = 0; while(!isdigit(c)){f = c == '-'; c = getchar();} while(isdigit(c)){ a = a * 10 + c - 48; c = getchar(); } ret…