Submission #00094


ソースコード

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
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
int i,j,k;
int n=0;
int ans=0;
int tmp=0;
char buff[1000];
int num[1000];
int box[5] = {5,7,5,7,7};
scanf("%d",&n);
while(n != 0){
for(i=0;i<1000;i++){
num[i] = 0;
}
for(i=0;i<n;i++){
scanf("%s",buff);
num[i] = strlen(buff);
}
i=0;
j=0;
k=0;
while(i < n-4){
tmp = num[i];
j=i;
k=0;
while(tmp <= box[k] && k < 5){
j++;
if(tmp == box[k]){
tmp = num[j];
k++;
}else{
tmp += num[j];
}
}
if(k == 5){
ans = i+1;
i = 100000;
}
i++;
}
printf("%d\n",ans);
scanf("%d",&n);
}
return 0;
}

ステータス

項目 データ
問題 0002 - 短句
ユーザー名 ei1401
投稿日時 2016-03-30 15:19:27
言語 C++
状態 Accepted
得点 15
ソースコード長 781 Byte
最大実行時間 19 ms
最大メモリ使用量 652 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
B1 AC 19 ms 476 KB
1
B2 AC 12 ms 448 KB
1
B3 AC 11 ms 424 KB
1
B4 AC 13 ms 652 KB
1