Submission #00074


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.io.*;
import java.util.*;
class Main{
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
int ans[] = new int[1000];
int count = 0;
while(true){
int n = cin.nextInt();
if(n==0)break;
String word[] = new String[n];
for(int i=0;i<n;i++){
word[i] = cin.next();
}
for(int i=0;i<n;i++){
int len[] = new int[5];
int len_num = 0;
boolean judge = true;
for(int j=i;j<n;j++){
len[len_num] += word[j].length();
if(len_num==0||len_num==2){
if(len[len_num]==5){
judge=true;
len_num++;
}
else if(len[len_num]>5){
judge=false;
break;
}
}
else{
if(len[len_num]==7){
judge=true;
if(len_num==4)break;
len_num++;
}
else if(len[len_num]>7){
judge=false;
break;
}
}
}
if(judge==true){
ans[count] = i+1;
count++;
break;
}
}
}
for(int i=0;i<count;i++){
System.out.println(ans[i]);
}
}
}

ステータス

項目 データ
問題 0002 - 短句
ユーザー名 ei1419
投稿日時 2016-03-30 14:39:27
言語 Java
状態 Accepted
得点 15
ソースコード長 1061 Byte
最大実行時間 80 ms
最大メモリ使用量 14760 KB

セット

セット 得点 Cases
1 ALL 15 / 15 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
B1 AC 80 ms 14760 KB
1
B2 AC 76 ms 14352 KB
1
B3 AC 76 ms 14680 KB
1
B4 AC 72 ms 14700 KB
1