結果

問題 No.2521 Don't be Same
ユーザー 👑 chro_96chro_96
提出日時 2023-10-27 23:09:47
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 1,720 bytes
コンパイル時間 1,336 ms
コンパイル使用メモリ 29,396 KB
実行使用メモリ 95,228 KB
最終ジャッジ日時 2023-10-27 23:09:56
合計ジャッジ時間 6,886 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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);
    } else if (y == 0) {
      printf("A 1 %d\n", x);
    } else if (x == y) {
      printf("B\n");
    } 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