Sol:
| #include <cstdio> | |
| int main() | |
| { | |
| char input[20]; | |
| scanf("%s", input); | |
| for (int t = 1; input[0] != '*'; ++t, scanf("%s", input)) | |
| { | |
| if (input[0] == 'H') | |
| printf("Case %d: Hajj-e-Akbar\n", t); | |
| else | |
| printf("Case %d: Hajj-e-Asghar\n", t); | |
| } | |
| } |
| #include <cstdio> | |
| int main() | |
| { | |
| char input[20]; | |
| scanf("%s", input); | |
| for (int t = 1; input[0] != '*'; ++t, scanf("%s", input)) | |
| { | |
| if (input[0] == 'H') | |
| printf("Case %d: Hajj-e-Akbar\n", t); | |
| else | |
| printf("Case %d: Hajj-e-Asghar\n", t); | |
| } | |
| } |
| #include <cstdio> | |
| #include <cstring> | |
| using namespace std; | |
| int main() { | |
| int tc, x; | |
| long long sum = 0; | |
| char s[20]; | |
| scanf("%d", &tc); | |
| while (tc--) { | |
| scanf("%s", s); | |
| if (strcmp(s, "donate") == 0) { | |
| scanf("%d", &x); | |
| sum += x; | |
| } else { | |
| printf("%lld\n", sum); | |
| } | |
| } | |
| return 0; | |
| } |
| #include <cstdio> | |
| using namespace std; | |
| int main() { | |
| int cnt = 1, tc; | |
| int l,w,h; | |
| scanf("%d",&tc); | |
| while(tc--){ | |
| scanf("%d %d %d",&l,&w,&h); | |
| printf("Case %d: ",cnt++); | |
| if(l<=20 && w<=20 && h<=20) printf("good\n"); | |
| else printf("bad\n"); | |
| } | |
| return 0; | |
| } |
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| int main() | |
| { | |
| int T; | |
| string temp; | |
| cin >> T; | |
| while (T--) | |
| { | |
| cin >> temp; | |
| if (temp.length() == 5) | |
| cout << "3\n"; | |
| else | |
| { | |
| int oneCorrect(0); | |
| if (temp[0] == 'o') | |
| ++oneCorrect; | |
| if (temp[1] == 'n') | |
| ++oneCorrect; | |
| if (temp[2] == 'e') | |
| ++oneCorrect; | |
| if (oneCorrect >= 2) | |
| cout << "1\n"; | |
| else | |
| cout << "2\n"; | |
| } | |
| } | |
| } |
| #include <cstdio> | |
| using namespace std; | |
| int main() { | |
| int n, count = 0; | |
| while (scanf("%d", &n), n) { | |
| count++; | |
| int sum = 0, t; | |
| for (int i = 0; i < n; i++) { | |
| scanf("%d", &t); | |
| if (t > 0) | |
| sum++; | |
| else | |
| sum--; | |
| } | |
| printf("Case %d: %d\n", count, sum); | |
| } | |
| return 0; | |
| } |
Đề bài: Bạn được cho 1 đồ thị vô hướng đặc biệt. Nó bao gồm $2n$ đỉnh được đánh số từ 1 đến 2n. Dưới đây là một số đặc tính của đồ thị: + ...