Sol:
| #include <cstdio> | |
| int main() | |
| { | |
| printf("KABIR\n"); | |
| } |
| #include <cstdio> | |
| int main() | |
| { | |
| printf("KABIR\n"); | |
| } |
| #include <cstdio> | |
| int main() | |
| { | |
| char input[100001]; | |
| int mem[100]; | |
| int T, current; | |
| scanf("%d", &T); | |
| for (int t = 1; t <= T; ++t) | |
| { | |
| for (int i = 0; i < 100; ++i) | |
| mem[i] = 0; | |
| current = 0; | |
| scanf("%s", &input); | |
| for (int i = 0; input[i]; ++i) | |
| { | |
| switch (input[i]) | |
| { | |
| case '>': | |
| ++current; | |
| if (current == 100) | |
| current = 0; | |
| break; | |
| case '<': | |
| --current; | |
| if (current == -1) | |
| current = 99; | |
| break; | |
| case '+': | |
| ++mem[current]; | |
| if (mem[current] == 256) | |
| mem[current] = 0; | |
| break; | |
| case '-': | |
| --mem[current]; | |
| if (mem[current] == -1) | |
| mem[current] = 255; | |
| } | |
| } | |
| printf("Case %d:", t); | |
| for (int i = 0; i < 100; ++i) | |
| printf(" %02X", mem[i]); | |
| printf("\n"); | |
| } | |
| } |
| #include <cstdio> | |
| int wantedSize[10010]; | |
| int main() | |
| { | |
| int height, length; | |
| while (scanf("%d %d", &height, &length), height) | |
| { | |
| int count(0); | |
| scanf("%d", &wantedSize[0]); | |
| count += height - wantedSize[0]; | |
| for (int i = 1; i < length; ++i) | |
| { | |
| scanf("%d", &wantedSize[i]); | |
| if (wantedSize[i] != height) | |
| { | |
| int temp = wantedSize[i - 1] - wantedSize[i]; | |
| if (temp > 0) | |
| count += temp; | |
| } | |
| } | |
| printf("%d\n", count); | |
| } | |
| } |
| #include <cstdio> | |
| #include <cstring> | |
| int recurse(int length, int count) | |
| { | |
| if (length == 1) | |
| return count + 1; | |
| int newLength(0), oldLength(length); | |
| for (; length; length /= 10, ++newLength); | |
| return recurse(newLength, count + 1); | |
| } | |
| int main() | |
| { | |
| char input[1000010]; | |
| while (scanf("%s", input), input[0] != 'E') | |
| { | |
| if (strlen(input) == 1 && input[0] == '1') | |
| printf("1\n"); | |
| else | |
| printf("%d\n", recurse(strlen(input), 1)); | |
| } | |
| } |
Đề 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ị: + ...