分类: codeforces

32 篇文章

thumbnail
Codeforces Round 1080 (Div. 3)
链接:https://codeforces.com/contest/2195 A. Sieve of Erato67henes 算法: 数学。 思路: 由于 [latex]67[/latex] 为质数,所有就是判断数组中有没有 [latex]67[/latex]。 关键代码: void miyan() { int n; cin >> n; set&…
thumbnail
Codeforces Round 1078 (Div. 2)
链接:https://codeforces.com/contest/2194 A. Lawn Mower 算法: 数学。 思路: 每隔 [latex]w - 1[/latex] 个木板保留一个木板,那么共保留 [latex]\lfloor \frac{w}{n} \rfloor[/latex] 个木板,拆除 [latex]n - \lfloor \…
thumbnail
Codeforces Round 1077 (Div. 2)
链接:https://codeforces.com/contest/2188 A. Divisible Permutation 算法: 构造。 思路: 打表找规律。 关键代码: void miyan() { int n; cin >> n; if (n & 1) { for (int i = n / 2 + 1; i >= 1; --i) …
thumbnail
Codeforces Round 1073 (Div. 2)
链接:https://codeforces.com/contest/2191 A. Array Coloring 算法: 模拟。 思路: 两种情况([latex]0[/latex] 开头,[latex]1[/latex] 开头),都试一遍。 关键代码: void miyan() { int n; cin >> n; vector<int> a…
thumbnail
Codeforces Round 1076 (Div. 3)
链接:https://codeforces.com/contest/2193 A. DBMB and the Array 算法: 贪心。 思路: 考虑到操作可以执行任意次,所以只要数组和与 [latex]s[/latex] 的差是 [latex]x[/latex] 的倍数就可以满足题目要求。 关键代码: void miyan() { ll n, s…
thumbnail
Codeforces Round 1056 (Div. 2)
链接:https://codeforces.com/contest/2155 A. El fucho 算法:     模拟。 思路:     打表。 关键代码: void miyan() { int n; cin >> n; cout << (n - 1) * 2 << endl; }…
thumbnail
Codeforces Round 1058 (Div. 2)
链接:https://codeforces.com/contest/2160 A. MEX Partition 算法:     贪心。 思路:     无。 关键代码: void miyan() { int n; cin >> n; set<int> s; for (int i = 0; i < …
thumbnail
Codeforces Round 1057 (Div. 2)
链接:https://codeforces.com/contest/2153 A. Circle of Apple Trees 算法:     贪心。 思路:     不同元素的个数。 关键代码: void miyan() { int n; cin >> n; vector<int> a(n); for (auto &x : a) c…