0 of 4 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 4 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
18题
1 2 3 4 5 6 7 8 9 10 11 |
#include <cstdio> char st[100]; int main() { scanf("%s", st); for (int i = 0; st[i]; ++i) { if ('A' <= st[i] && st[i] <= 'Z') st[i] += 1; } printf("%s", st); return 0; } |
输入:QuanGuoLianSai
输出为:
19题
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#include <cstdio> int main() { int x; scanf("%d", &x); int res = 0; for (int i = 0; i < x; ++i) { if (i * i % x == 1) { ++res; } } printf("%d", res); return 0; } |
输入:15
输出:
20题
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#include <iostream> using namespace std; int n, m; int findans(int n, int m) { if (n == 0) return m; if (m == 0) return n % 3; return findans(n - 1, m) - findans(n, m - 1) + findans(n - 1, m - 1); } int main(){ cin >> n >> m; cout << findans(n, m) << endl; return 0; } |
输入:5 6
输出:
21题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include <cstdio> int n, d[100]; bool v[100]; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", d + i); v[i] = false; } int cnt = 0; for (int i = 0; i < n; ++i) { if (!v[i]) { for (int j = i; !v[j]; j = d[j]) { v[j] = true; } ++cnt; } } printf("%d", cnt); return 0; } |
输入:10 7 1 4 3 2 5 9 8 0 6
输出: