Submission #00078


ソースコード

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
55
#include<string.h>
#include <stdio.h>
#include<math.h>
int main(){
int num,i=0,j=0,flag=0;
int check[2][5] = {};
char high[41][11]={};
check[0][0] = 5;
check[0][1] = 7;
check[0][2] = 5;
check[0][3] = 7;
check[0][4] = 7;
scanf("%d",&num);
while(num != 0){
//flagを初期化
flag = 0; j=0;
//配列を初期化
for(i=0;i<5;i++) check[1][i]=0;
//num秒分文字列をscan
for(i=0;i<num;i++){
scanf("%s",high[i]);
}
//i=57577
i=0;
while(i<5){
//規定通りの文字の方が大きい間
while(check[1][i] < check[0][i]){
check[1][i] += strlen(high[j]);
//printf("check[1][%d]=%d\n",i,check[1][i]);
j++;
}
//大きくなってしまった場合を考える
if(check[0][i] < check[1][i]){
//配列を初期化
for(j=0;j<=i;j++) check[1][j]=0;
flag+=1; j=flag; i=0;
} else {
i++;
}
}
printf("%d\n",flag+1);
scanf("%d",&num);
}
return 0;
}

ステータス

項目 データ
問題 0002 - 短句
ユーザー名 ei1436
投稿日時 2016-03-30 14:51:05
言語 C
状態 Accepted
得点 15
ソースコード長 1033 Byte
最大実行時間 12 ms
最大メモリ使用量 596 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
B1 AC 12 ms 380 KB
1
B2 AC 11 ms 536 KB
1
B3 AC 12 ms 596 KB
1
B4 AC 12 ms 428 KB
1