結果
問題 | No.88 次はどっちだ |
ユーザー |
|
提出日時 | 2015-05-24 01:40:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 131 ms / 5,000 ms |
コード長 | 804 bytes |
コンパイル時間 | 3,487 ms |
コンパイル使用メモリ | 78,968 KB |
実行使用メモリ | 41,716 KB |
最終ジャッジ日時 | 2024-07-06 06:24:51 |
合計ジャッジ時間 | 5,602 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
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"); } } } }