結果
| 問題 |
No.2521 Don't be Same
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2023-10-27 23:21:43 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 1,786 bytes |
| コンパイル時間 | 502 ms |
| コンパイル使用メモリ | 29,696 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 10.18 |
| 最終ジャッジ日時 | 2024-09-25 15:19:26 |
| 合計ジャッジ時間 | 3,678 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
#include <stdio.h>
int main () {
int x = 0;
int y = 0;
char op[2] = "";
int i = 0;
int xx = 0;
int res = 0;
int is_fin = 0;
res = scanf("%d", &x);
res = scanf("%d", &y);
if ((x < y && x%2 == 1 && x+1==y) || (x > y && y%2 == 1 && y+1 ==x)) {
printf("Second\n");
fflush(stdout);
res = scanf("%s", op);
if (op[0] == 'A') {
res = scanf("%d", &i);
res = scanf("%d", &xx);
if (i == 1) {
x -= xx;
} else {
y -= xx;
}
} else if (op[0] == 'B') {
x = 0;
y = 0;
} else {
is_fin = 1;
}
} else {
printf("First\n");
fflush(stdout);
}
while (is_fin <= 0) {
if (x == 0) {
printf("A 2 %d\n", y);
fflush(stdout);
} else if (y == 0) {
printf("A 1 %d\n", x);
fflush(stdout);
} else if (x == y) {
printf("B\n");
fflush(stdout);
} else if (x < y && x+1 == y) {
printf("A 2 2\n");
fflush(stdout);
y -= 2;
} else if (y < x && y+1 == x) {
printf("A 1 2\n");
fflush(stdout);
x -= 2;
} else if (x < y && x%2 == 1) {
printf("A 2 %d\n", y-x-1);
fflush(stdout);
y = x+1;
} else if (x < y) {
printf("A 2 %d\n", y-x+1);
fflush(stdout);
y = x-1;
} else if (y%2 == 1) {
printf("A 1 %d\n", x-y-1);
fflush(stdout);
x = y+1;
} else {
printf("A 1 %d\n", x-y+1);
fflush(stdout);
x = y-1;
}
res = scanf("%s", op);
if (op[0] == 'A') {
res = scanf("%d", &i);
res = scanf("%d", &xx);
if (i == 1) {
x -= xx;
} else {
y -= xx;
}
} else if (op[0] == 'B') {
x = 0;
y = 0;
} else {
is_fin = 1;
}
}
return 0;
}
chro_96