結果

問題 No.345 最小チワワ問題
ユーザー 37zigen37zigen
提出日時 2016-03-11 01:44:57
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 2,040 ms
コンパイル使用メモリ 75,372 KB
実行使用メモリ 57,776 KB
最終ジャッジ日時 2023-10-25 04:10:21
合計ジャッジ時間 7,741 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
57,644 KB
testcase_01 AC 125 ms
57,652 KB
testcase_02 AC 123 ms
57,584 KB
testcase_03 AC 123 ms
57,392 KB
testcase_04 AC 123 ms
57,456 KB
testcase_05 AC 126 ms
57,496 KB
testcase_06 AC 127 ms
57,448 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 128 ms
57,148 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 136 ms
57,132 KB
testcase_15 AC 127 ms
55,520 KB
testcase_16 AC 123 ms
57,168 KB
testcase_17 AC 122 ms
57,116 KB
testcase_18 AC 126 ms
57,536 KB
testcase_19 AC 124 ms
57,368 KB
testcase_20 AC 119 ms
57,228 KB
testcase_21 WA -
testcase_22 AC 111 ms
56,244 KB
testcase_23 AC 122 ms
57,448 KB
testcase_24 AC 122 ms
57,700 KB
testcase_25 AC 122 ms
57,392 KB
testcase_26 AC 121 ms
57,248 KB
testcase_27 AC 122 ms
57,424 KB
testcase_28 WA -
testcase_29 AC 125 ms
57,424 KB
testcase_30 AC 125 ms
57,516 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String str=sc.next();
		int ans=Integer.MAX_VALUE;
		for(int i=0;i<str.length();i++){
			for(int j=i+1;j<str.length();j++){
				for(int k=j+1;k<str.length();k++){
					if(str.charAt(i)=='c'&&str.charAt(j)=='w'&&str.charAt(k)=='w'){
						ans=Math.min(ans,k-i+1);
					}
				}
			}
		}
		System.out.println(ans);
	}
}
0