链接:https://ac.nowcoder.com/acm/contest/127264 A - 小红的大小判断 算法: 模拟。 思路: 无。 关键代码: void miyan() { int x; cin >> x; if (x > x * x) cout << "left" << endl; else…
链接:https://codeforces.com/contest/2191 A. Array Coloring 算法: 模拟。 思路: 两种情况([latex]0[/latex] 开头,[latex]1[/latex] 开头),都试一遍。 关键代码: void miyan() { int n; cin >> n; vector<int> a…
链接:https://codeforces.com/contest/2193 A. DBMB and the Array 算法: 贪心。 思路: 考虑到操作可以执行任意次,所以只要数组和与 [latex]s[/latex] 的差是 [latex]x[/latex] 的倍数就可以满足题目要求。 关键代码: void miyan() { ll n, s…
链接:https://atcoder.jp/contests/abc441 A - Black Square 算法: 模拟。 思路: 无。 关键代码: void miyan() { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (x2 >= x1 && y2 >= y1 &a…
链接:https://atcoder.jp/contests/abc442 A - Count . 算法: 模拟。 思路: 无。 关键代码: void miyan() { string s; cin >> s; ll ans = 0; for (auto c : s) if (c == 'i' || c == 'j') ++ans; cout &l…