結果

問題 No.1016 三目並べ
ユーザー ks2mks2m
提出日時 2020-04-03 21:46:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,017 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 73,980 KB
実行使用メモリ 52,836 KB
最終ジャッジ日時 2023-09-16 00:55:18
合計ジャッジ時間 3,351 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,324 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

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 % 2 == 1) {
							pw.println("O");
							continue label;
						}
						cnt = 0;
					} else if (s.charAt(j) == 'x') {
						cnt = 0;
					} else {
						cnt++;
					}
				}
				pw.println("X");
			}
		}
		br.close();
		pw.flush();
	}
}
0