結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-11-12 18:16:50 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 1,987 ms |
コンパイル使用メモリ | 74,156 KB |
実行使用メモリ | 41,344 KB |
最終ジャッジ日時 | 2024-11-25 21:21:55 |
合計ジャッジ時間 | 6,626 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int a =S.indexOf("c"); if(a==-1){ System.out.println(-1); }else{ S = S.substring(a); int b = S.indexOf("w"); String t = S.substring(b+1); int c = t.indexOf("w"); if(c==-1){ System.out.println(-1); }else{ System.out.println(b+c+2); } } } }