結果

問題 No.88 次はどっちだ
ユーザー k_kadorak_kadora
提出日時 2015-05-24 01:40:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 3,270 ms
コンパイル使用メモリ 76,896 KB
実行使用メモリ 57,912 KB
最終ジャッジ日時 2023-09-20 10:57:31
合計ジャッジ時間 5,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,664 KB
testcase_01 AC 115 ms
56,100 KB
testcase_02 AC 115 ms
55,780 KB
testcase_03 AC 115 ms
56,204 KB
testcase_04 AC 116 ms
55,920 KB
testcase_05 AC 117 ms
55,792 KB
testcase_06 AC 117 ms
56,200 KB
testcase_07 AC 114 ms
57,912 KB
testcase_08 AC 113 ms
55,764 KB
testcase_09 AC 117 ms
56,104 KB
testcase_10 AC 114 ms
55,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Reversi{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int count=0,s=0;
		String first,in="";
		Pattern pb = Pattern.compile("b");
		Pattern pw = Pattern.compile("w");
		first = sc.next();
		for(int i = 0;i<8;i++){
			in = in + sc.next();
		}
		Matcher mb = pb.matcher(in);
		Matcher mw = pw.matcher(in);
		while(mb.find(s)){
			count++;
			s = mb.end();
		}
		s = 0;
		while(mw.find(s)){
			count++;
			s = mw.end();
		}
		if(first.equals("oda")){
			if(count %2 == 0){
				System.out.println("oda");
			}else{
				System.out.println("yukiko");
			}
		}else{
			if(count%2 == 0){
				System.out.println("yukiko");
			}else{
				System.out.println("oda");
			}
		}
	}
}
		
0