提出 #533482


ソースコード 拡げる

#include <stdio.h>
#include <string.h>

int main(){
	int n,i,t;
	char s[101];
	char *tmp1,*tmp2,*tmp3;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		tmp1 = s;
		t = 0;
		while(tmp1 != NULL){
			tmp2 = strstr(tmp1,"tokyo");
			tmp3 = strstr(tmp1,"kyoto");
			if(((tmp2 != NULL)||(tmp3 != NULL)) && ((tmp1 != tmp2) || (tmp1 != tmp3))) t++;
			if(tmp2 == NULL) tmp1 = tmp3;
			else if(tmp3 == NULL) tmp1 = tmp2;
			else tmp1 = tmp2<tmp3?tmp2:tmp3;
			if(tmp1 != NULL) tmp1 += 5;
		};
		printf("%d\n",t);
	}
	return 0;
}

提出情報

提出日時
問題 A - 東京都
ユーザ niconico774
言語 C (GCC 4.9.2)
得点 100
コード長 549 Byte
結果 AC
実行時間 26 ms
メモリ 804 KiB

コンパイルエラー

./Main.c: In function ‘main’:
./Main.c:8:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ^
./Main.c:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",s);
   ^

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 3
セット名 テストケース
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
ケース名 結果 実行時間 メモリ
10_random_to_kyo.txt AC 23 ms 796 KiB
20_noised_tokyoto.txt AC 25 ms 700 KiB
99_teuchi.txt AC 26 ms 804 KiB