Submission #533070


Source Code Expand

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

int solve(void);

int main(void){
  int T;
  
  scanf("%d",&T);
  while(T--){
    printf("%d\n",solve());
  }
  return 0;
}

int solve(void){
  char str[128],*p,*pk,*pt;
  int num=0;

  scanf("%s",str);

  pk=strstr(str,"kyoto");
  pt=strstr(str,"tokyo");
  while(pk!=NULL || pt!=NULL){
    if(pk==NULL || pt<pk){
      p=pt+5;
      num++;
    }else if(pt==NULL || pk<pt){
      p=pk+5;
      num++;
    }
    pk=strstr(p,"kyoto");
    pt=strstr(p,"tokyo");
  }
  return num;
}

Submission Info

Submission Time
Task A - 東京都
User tatuyan
Language C (GCC 4.9.2)
Score 0
Code Size 553 Byte
Status RE
Exec Time 376 ms
Memory 796 KB

Compile Error

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

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
RE × 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 RE 376 ms 692 KB
20_noised_tokyoto.txt RE 275 ms 792 KB
99_teuchi.txt RE 274 ms 796 KB