Submission #37686


ソースコード

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
#include<stdio.h>
#include<string.h>
int main(){
char buff[101],word[500001];
int n,ans=0;
scanf("%d ",&n);
fgets(word,sizeof(word),stdin);
word[strlen(word) - 1] = '\0';
//printf("%s\n",word);
int i,j,l,ce;
for(i=0;i<n;i++){
fgets(buff,sizeof(buff),stdin);
buff[strlen(buff) - 1] = '\0';
for(j=0;buff[j]!='\0';j++){
// printf("%c",buff[j]);
if((j==0||buff[j-1]==' ')&&buff[j]==word[0]){
ce=0;
j++;
for(l=1;word[l]!='\0';l++,j++){
if(buff[j]!=word[l]){
ce=1;
break;
}
}
if(ce==0&&(buff[j]==' '||buff[j]=='\0')){
ans++;
//printf("[%d]\n",j);
}
}
}
}
printf("%d\n",ans);
return(0);
}

ステータス

項目 データ
問題 0003 - 聖書
ユーザー名 ei1708
投稿日時 2018-06-20 16:38:51
言語 C
状態 Accepted
得点 5
ソースコード長 723 Byte
最大実行時間 25 ms
最大メモリ使用量 400 KB

セット

セット 得点 Cases
1 ALL 3 / 3 *
2 SUB1 1 / 1 Alice_in1.txt
3 SUB2 1 / 1 Alice_in2.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Alice_in1.txt AC 23 ms 380 KB
1
2
Alice_in2.txt AC 19 ms 400 KB
1
3
Alice_in3.txt AC 25 ms 348 KB
1