結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー | AoiroFukurou |
提出日時 | 2017-02-26 13:35:21 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 3,426 ms |
コンパイル使用メモリ | 71,972 KB |
実行使用メモリ | 56,436 KB |
最終ジャッジ日時 | 2023-09-02 09:51:06 |
合計ジャッジ時間 | 8,507 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
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,100 KB |
testcase_15 | WA | - |
testcase_16 | AC | 119 ms
56,120 KB |
testcase_17 | AC | 120 ms
56,232 KB |
testcase_18 | AC | 122 ms
56,112 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 121 ms
56,388 KB |
testcase_22 | WA | - |
testcase_23 | AC | 118 ms
56,076 KB |
testcase_24 | AC | 120 ms
56,108 KB |
testcase_25 | AC | 118 ms
55,924 KB |
testcase_26 | AC | 118 ms
55,972 KB |
testcase_27 | AC | 120 ms
55,900 KB |
ソースコード
import java.util.Scanner; public class No_486 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int W = 0; int L = 0; for (int i = 1; i <= s.length(); i++) { String s2 = s.substring(i - 1, i); if (s2.equals("O")) { W++; L = 0; } else if (s2.equals("X")) { L++; W = 0; } } if (W >= 3) { System.out.println("West"); } else if (L >= 3) { System.out.println("East"); } else { System.out.println("NA"); } } }