結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
TatsuDX
|
| 提出日時 | 2016-09-03 15:00:11 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 494 bytes |
| 記録 | |
| コンパイル時間 | 2,570 ms |
| コンパイル使用メモリ | 83,196 KB |
| 実行使用メモリ | 48,588 KB |
| 最終ジャッジ日時 | 2026-05-10 17:07:43 |
| 合計ジャッジ時間 | 6,604 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 2 TLE * 1 -- * 26 |
ソースコード
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int a, b, c, min = 1000;
a = s.indexOf('c');
while(a >= 0){
b = s.indexOf('w', a);
if(b < 0){
continue;
}
c = s.indexOf('w', b+1);
if(c < 0){
continue;
}
min = Math.min(min, c-a+1);
a = s.indexOf('c', a+1);
}
if(min < 1000){
System.out.println(min);
} else {
System.out.println(-1);
}
}
}
TatsuDX