結果
問題 | No.1016 三目並べ |
ユーザー | ks2m |
提出日時 | 2020-04-03 21:48:59 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,058 bytes |
コンパイル時間 | 2,160 ms |
コンパイル使用メモリ | 74,300 KB |
実行使用メモリ | 54,564 KB |
最終ジャッジ日時 | 2023-09-16 01:00:47 |
合計ジャッジ時間 | 3,534 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
49,672 KB |
testcase_01 | AC | 42 ms
49,320 KB |
testcase_02 | AC | 43 ms
49,328 KB |
testcase_03 | AC | 48 ms
49,820 KB |
testcase_04 | WA | - |
testcase_05 | AC | 46 ms
49,356 KB |
testcase_06 | AC | 47 ms
49,408 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); PrintWriter pw = new PrintWriter(System.out); label: for (int i = 0; i < t; i++) { String[] sa = br.readLine().split(" "); String s = sa[1]; if (s.indexOf("ooo") != -1 || s.indexOf("oo-") != -1 || s.indexOf("-oo") != -1 || s.indexOf("--o-") != -1 || s.indexOf("-o--") != -1 || s.indexOf("o-o") != -1 ) { pw.println("O"); } else { int cnt = 0; for (int j = 0; j < s.length(); j++) { if (s.charAt(j) == 'o') { if (cnt > 0 && cnt % 2 == 2) { pw.println("O"); continue label; } cnt = 1; } else if (s.charAt(j) == 'x') { cnt = 0; } else { if (cnt > 0) { cnt++; } } } pw.println("X"); } } br.close(); pw.flush(); } }