Submission #02423
ソースコード
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 | #include <iostream> #include <string> #include <cstdio> using namespace std; #define CAPA 100 int main() { int n, i, j, count=0; string keyword, word; char sentence; cin >> n >> keyword; sentence = getchar (); for ( i=0; i<n; i++ ) { for ( j=0; j<CAPA; j++ ) { sentence = getchar (); if ( sentence == '\n' ) break ; else if ( sentence == ' ' ) { if ( keyword.compare( word ) == 0 ) { count++; word.clear(); } else word.clear(); } else { switch ( sentence ) { case '.' : case '!' : word.clear(); break ; default : word += sentence; } } } } cout << count << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - 聖書 |
ユーザー名 | sth1420 |
投稿日時 | 2015-12-17 15:49:30 |
言語 | C++11 |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 685 Byte |
最大実行時間 | 20 ms |
最大メモリ使用量 | 564 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
2 | SUB1 | 1 / 1 | Alice_in1.txt |
3 | SUB2 | 1 / 1 | Alice_in2.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||
---|---|---|---|---|---|---|
Alice_in1.txt | AC | 20 ms | 472 KB |
1
|
2
|
|
Alice_in2.txt | AC | 17 ms | 456 KB |
1
|
3
|
|
Alice_in3.txt | AC | 13 ms | 564 KB |
1
|