Submission #00093


ソースコード

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
main(){
int i, j, k, n, flag, ans = 0, cnt, check = 0;
int count[50];
int data[40];
int front[40];
int plus1[40];
char input[40][11];
while(true){
check = 0;
flag = 1;
ans = 1;
cin >> n;
if(n == 0){
break;
}
for(i = 0; i < n; i++){
cin >> input[i];
data[i] = strlen(input[i]);
}
for(i = 1; i < n; i++){
plus1[i] = data[i-1] + data[i];
}
cnt = 0;
for(i = 0; i < n; i++){
if(data[i] == 5){
front[cnt] = i;
cnt++;
}
}
check = cnt - 1;
for(i = 1; i < n; i++){
if(plus1[i] == 5){
front[cnt] = i;
cnt++;
}
}
for(i = 0; i < cnt; i++){
flag = 2;
for(j = front[i] + 1; j < n; j++){
if(flag == 2){
if(data[j] == 7){
flag++;
}else if((data[j] + data[j+1]) == 7){
flag++;
j += 1;
}else if((data[j] + data[j+1] + data[j+2]) == 7){
flag++;
j += 2;
}else if((data[j] + data[j+1] + data[j+2] + data[j+3]) == 7){
flag++;
j += 3;
}else{
break;
}
}else if(flag == 3){
if(data[j] == 5){
flag++;
}else if((data[j] + data[j+1]) == 5){
flag++;
j += 1;
}else if((data[j] + data[j+1] + data[j+2]) == 5){
flag++;
j += 2;
}else{
break;
}
}else if(flag == 4){
if(data[j] == 7){
flag++;
}else if((data[j] + data[j+1]) == 7){
flag++;
j += 1;
}else if((data[j] + data[j+1] + data[j+2]) == 7){
flag++;
j += 2;
}else if((data[j] + data[j+1] + data[j+2] + data[j+3]) == 7){
flag++;
j += 3;
}else{
break;
}
}else if(flag == 5){
if(data[j] == 7){
flag = 6;
if(check >= i){
flag = 7;
}
break;
}else if((data[j] + data[j+1]) == 7){
flag = 6;
if(check >= i){
flag = 7;
}
break;
}else if((data[j] + data[j+1] + data[j+2]) == 7){
flag = 6;
if(check >= i){
flag = 7;
}
break;
}else if((data[j] + data[j+1] + data[j+2] + data[j+3]) == 7){
flag = 6;
if(check >= i){
flag = 7;
}
break;
}else{
break;
}
}
}
if(flag == 6){
ans = front[i];
break;
}else if(flag == 7){
ans += front[i];
break;
}
}
cout << ans << endl;
}
}

ステータス

項目 データ
問題 0002 - 短句
ユーザー名 ei1424
投稿日時 2016-03-30 15:18:17
言語 C++
状態 Wrong Answer
得点 0
ソースコード長 2459 Byte
最大実行時間 18 ms
最大メモリ使用量 476 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
B1 WA 18 ms 476 KB
1
B2 WA 12 ms 452 KB
1
B3 WA 10 ms 436 KB
1
B4 WA 14 ms 412 KB
1