結果

問題 No.345 最小チワワ問題
ユーザー 37zigen
提出日時 2016-03-11 01:44:57
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 2,215 ms
コンパイル使用メモリ 75,452 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2024-09-24 23:35:04
合計ジャッジ時間 7,690 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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