結果
| 問題 |
No.486 3 Straight Win(3連勝)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-21 23:27:49 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 737 bytes |
| コンパイル時間 | 3,324 ms |
| コンパイル使用メモリ | 73,296 KB |
| 実行使用メモリ | 37,036 KB |
| 最終ジャッジ日時 | 2024-06-26 04:34:41 |
| 合計ジャッジ時間 | 5,202 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class No486 {
public static void main(String[] args) throws IOException{
String str = new BufferedReader(new InputStreamReader(System.in)).readLine();
char[] syohai = str.toCharArray();
judge(syohai);
}
public static void judge(char[] chr){
int eastV = 0;
int westV = 0;
for(int i=0; i<chr.length; i++){
if(chr[i] == 'O'){
eastV++;
westV = 0;
} else if(chr[i] == 'X'){
westV++;
eastV = 0;
}
if(eastV == 3) {
System.out.println("East");
break;
} else if(westV == 3) {
System.out.println("West");
break;
}
}
if(eastV != 3 && westV != 3) System.out.println("NA");
}
}