Submission #00083
ソースコード
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 | #include<bits/stdc++.h> using namespace std; main(){ int n; string str[41]; int len[41] = {0}; int nowlen = 0; int step = 0; int suc = 0; int ans = 0; int i,j; while (1){ cin >> n; if (n == 0) break ; for (i = 0;i < n;i++){ cin >> str[i]; len[i] = str[i].size(); } for (i = 0;i < n;i++){ for (j = i;j < n;j++){ nowlen += len[j]; if (step == 0){ if (nowlen == 5){ step++; nowlen = 0; } else if (nowlen > 5){ step = 0; nowlen = 0; break ; } } else if (step == 1){ if (nowlen == 7){ step++; nowlen = 0; } else if (nowlen > 7){ step = 0; nowlen = 0; break ; } } else if (step == 2){ if (nowlen == 5){ step++; nowlen = 0; } else if (nowlen > 5){ step = 0; nowlen = 0; break ; } } else if (step == 3){ if (nowlen == 7){ step++; nowlen = 0; } else if (nowlen > 7){ step = 0; nowlen = 0; break ; } } else if (step == 4){ if (nowlen == 7){ ans = i + 1; step = 0; nowlen = 0; break ; } else if (nowlen > 7){ step = 0; nowlen = 0; break ; } } } if (ans != 0){ break ; } } cout << ans << endl; step = 0; ans = 0; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - 短句 |
ユーザー名 | ei1421 |
投稿日時 | 2016-03-30 14:56:49 |
言語 | C++ |
状態 | Accepted |
得点 | 15 |
ソースコード長 | 1381 Byte |
最大実行時間 | 14 ms |
最大メモリ使用量 | 556 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 15 / 15 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
B1 | AC | 13 ms | 472 KB |
1
|
B2 | AC | 14 ms | 448 KB |
1
|
B3 | AC | 12 ms | 556 KB |
1
|
B4 | AC | 14 ms | 536 KB |
1
|