結果

問題 No.2521 Don't be Same
ユーザー 👑 chro_96chro_96
提出日時 2023-10-27 23:21:43
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 1,786 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 29,568 KB
実行使用メモリ 24,588 KB
平均クエリ数 10.57
最終ジャッジ日時 2023-10-27 23:21:48
合計ジャッジ時間 4,437 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
24,576 KB
testcase_01 AC 67 ms
24,588 KB
testcase_02 AC 71 ms
24,588 KB
testcase_03 AC 73 ms
24,588 KB
testcase_04 AC 67 ms
24,588 KB
testcase_05 AC 69 ms
24,588 KB
testcase_06 AC 67 ms
24,588 KB
testcase_07 AC 68 ms
24,588 KB
testcase_08 AC 69 ms
24,588 KB
testcase_09 AC 69 ms
24,588 KB
testcase_10 AC 67 ms
24,588 KB
testcase_11 AC 68 ms
24,588 KB
testcase_12 AC 69 ms
24,588 KB
testcase_13 AC 66 ms
24,588 KB
testcase_14 AC 67 ms
24,588 KB
testcase_15 AC 66 ms
24,588 KB
testcase_16 AC 67 ms
24,588 KB
testcase_17 AC 67 ms
24,588 KB
testcase_18 AC 67 ms
24,588 KB
testcase_19 AC 67 ms
24,588 KB
testcase_20 AC 67 ms
24,588 KB
testcase_21 AC 66 ms
24,588 KB
testcase_22 AC 69 ms
24,588 KB
testcase_23 AC 66 ms
24,588 KB
testcase_24 AC 68 ms
24,588 KB
testcase_25 AC 70 ms
24,588 KB
testcase_26 AC 70 ms
24,588 KB
testcase_27 AC 70 ms
24,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0