結果
問題 |
No.486 3 Straight Win(3連勝)
|
ユーザー |
![]() |
提出日時 | 2018-02-10 14:40:53 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 126 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 2,286 ms |
コンパイル使用メモリ | 74,204 KB |
実行使用メモリ | 41,672 KB |
最終ジャッジ日時 | 2024-06-26 04:38:36 |
合計ジャッジ時間 | 6,326 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String s = sc.next(); int west = 0; int east = 0; boolean win = false; for (int i=0; i<s.length(); i++) { if (s.charAt(i)=='O') {east++; west = 0;} else {west++; east = 0;} if (west==3 || east==3) {win = true; break;} } if (win==true) { if (west==3) {System.out.println("West");} else if (east==3) {System.out.println("East");} } else { System.out.println("NA"); } } }