题目链接:Codeforces Round 1016 (Div. 3)
A. Ideal Generator

输入示例:
输出示例:
参考代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #include <bits/stdc++.h> using namespace std;
int t, n;
signed main() { cin >> t; while (t--) { cin >> n; if(n%2 == 0) cout << "No" << endl; else cout << "Yes" << endl; } }
|
B. Expensive Number

输入示例:
输出示例:
参考代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #include <bits/stdc++.h> using namespace std;
int t, n;
signed main() { cin >> t; while (t--) { string s; cin >> s;
int count = 0; bool flag = false;
for (int i = s.size() - 1; i >= 0; --i) { if (s[i] != '0') { flag = true; } else if (flag) { count++; } }
cout << s.size() - (count + 1) << '\n'; } }
|
C. Simple Repetition+

输入示例:
输出示例:
参考代码: