結果
問題 |
No.88 次はどっちだ
|
ユーザー |
|
提出日時 | 2015-08-09 20:08:44 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 118 ms / 5,000 ms |
コード長 | 678 bytes |
コンパイル時間 | 3,338 ms |
コンパイル使用メモリ | 75,108 KB |
実行使用メモリ | 41,572 KB |
最終ジャッジ日時 | 2024-07-18 06:16:10 |
合計ジャッジ時間 | 4,924 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import java.util.*; public class WhoIsNext{ public static void main(String... args){ Scanner scan = new Scanner(System.in); String f = scan.next(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < 8; i++){ sb.append(scan.next()); } String base = sb.toString(); System.out.println(checkWhoIsNext(f,base)); } public static String checkWhoIsNext(String f,String base){ int count = 0; String next=""; if(f.equals("oda")){ next="yukiko"; }else{ next="oda"; } for(int i = 0; i < base.length(); i++){ if(base.substring(i,i+1).equals("w") || base.substring(i,i+1).equals("b")){ count++; } } return (count%2==0)? f:next; } }