結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
ki_ki33
|
| 提出日時 | 2015-02-13 00:47:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,894 bytes |
| コンパイル時間 | 2,292 ms |
| コンパイル使用メモリ | 82,268 KB |
| 実行使用メモリ | 66,960 KB |
| 最終ジャッジ日時 | 2024-06-23 19:34:50 |
| 合計ジャッジ時間 | 8,749 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 20 |
ソースコード
import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListSet;
public class Main {
public static final int C = 1000000007;
static final int CY = 1000000000;
//static boolean MAP[][];
static int T;
static int N;
static double P;
//static String S;
static int M;
static int MAX = -1;
//static int tic[][];
static String S[];
static int Y[];
static double W[];
//static int max;
static long DP[];
static int ST[][];
//static int p[];
//static ArrayList<HashSet<Integer>> al;
static ConcurrentSkipListSet<Integer> TS;
static ArrayList<Integer> AL;
//static int a[][];
//static char[][] ch;
//static ArrayList<HashMap<Long, Long>> al;
//static String a[];
//static String str;
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
BufferedInputStream bs = new BufferedInputStream(System.in);
Scanner sc = new Scanner(bs);
T = sc.nextInt();
S = new String[T];
for (int i=0; i < T; i++) {
S[i] = sc.next();
}
long[] ans = new long[T];
for (int t=0; t < T; t++) {
int[] good = new int[S[t].length()];
int[] problem = new int[S[t].length()];
for (int i=0; i < S[t].length(); i++) {
if (S[t].length() - i < 11) {
good[i] = -1;
}else {
int num = 0;
if (S[t].charAt(i) == 'g') {
num++;
}
if (S[t].charAt(i+1) == 'o') {
num++;
}
if (S[t].charAt(i+2) == 'o') {
num++;
}
if (S[t].charAt(i+3) == 'd') {
num++;
}
good[i] = num;
}
if (i < 4|| S[t].length() - i < 7) {
problem[i] = -1;
}else {
int num = 0;
if (S[t].charAt(i) == 'p') {
num++;
}
if (S[t].charAt(i+1) == 'r') {
num++;
}
if (S[t].charAt(i+2) == 'o') {
num++;
}
if (S[t].charAt(i+3) == 'b') {
num++;
}
if (S[t].charAt(i+4) == 'l') {
num++;
}
if (S[t].charAt(i+5) == 'e') {
num++;
}
if (S[t].charAt(i+6) == 'm') {
num++;
}
problem[i] = num;
}
}
for (int i=0; i < S[t].length(); i++) {
System.out.print(good[i] + ", ");
}
System.out.println();
for (int i=0; i < S[t].length(); i++) {
System.out.print(problem[i] + ", ");
}
System.out.println();
int min = 10000;
for (int i=0; i < S[t].length(); i++) {
if (good[i] == -1)break;
int num = 4 - good[i];
int max = 0;
for (int v=i+4; v < S[t].length(); v++) {
if (problem[v] == -1)continue;
if (max < problem[v]) {
max = problem[v];
}
}
num += 7 - max;
if (min > num) {
min = num;
}
}
ans[t] = min;
}
for (int i=0; i < T; i++) {
sb.append(ans[i] + "\n");
}
System.out.print(sb);
}
}
ki_ki33