Submission #533482


Source Code Expand

#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;
}

Submission Info

Submission Time
Task A - 東京都
User niconico774
Language C (GCC 4.9.2)
Score 100
Code Size 549 Byte
Status AC
Exec Time 26 ms
Memory 804 KiB

Compile Error

./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);
   ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 3
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
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