結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
![]() |
提出日時 | 2015-02-23 17:02:22 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 207 ms / 5,000 ms |
コード長 | 633 bytes |
コンパイル時間 | 2,185 ms |
コンパイル使用メモリ | 74,708 KB |
実行使用メモリ | 41,928 KB |
最終ジャッジ日時 | 2024-10-11 01:53:28 |
合計ジャッジ時間 | 6,418 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
ソースコード
import java.math.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String good = "good"; String problem="problem"; for(int i=0;i<n;i++){ String moto = sc.next(); int ans=11; for(int j=0;j<=moto.length()-11;j++){ for(int k=j+4;k<=moto.length()-7;k++){ int count=0; for(int l=0;l<=3;l++){ if(moto.charAt(j+l)!=good.charAt(l))count++; } for(int l=0;l<=6;l++){ if(moto.charAt(k+l)!=problem.charAt(l))count++; } ans=Math.min(ans, count); } } System.out.println(ans); } } }