結果

問題 No.486 3 Straight Win(3連勝)
ユーザー あsdfあsdf
提出日時 2017-04-02 01:20:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 72,328 KB
実行使用メモリ 56,292 KB
最終ジャッジ日時 2023-09-22 02:29:41
合計ジャッジ時間 6,813 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,608 KB
testcase_01 AC 118 ms
55,776 KB
testcase_02 AC 118 ms
55,440 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 120 ms
56,028 KB
testcase_15 WA -
testcase_16 AC 120 ms
55,768 KB
testcase_17 AC 121 ms
55,832 KB
testcase_18 AC 120 ms
55,820 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 120 ms
55,400 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 120 ms
55,744 KB
testcase_25 AC 119 ms
55,780 KB
testcase_26 AC 120 ms
55,940 KB
testcase_27 AC 124 ms
55,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();

    if (a.length() < 3) {
      System.out.println("NA");
      return;
    }
    char[] ca = a.toCharArray();

    for (int i = 2; i < ca.length; i++) {
      if (ca[i] == ca[i - 1] && ca[i - 1] == ca[i - 2] && ca[i] == ca[i - 2]) {
        if (ca[i] == 'O') {
          System.out.println("East");
          break;
        } else if (ca[i] == 'X') {
          System.out.println("West");
          break;
        } else {
          System.out.println("へんだよ!");
          break;
        }
      } else {
        System.out.println("NA");
        break;
      }
    }

  }
}
0