Submission #532985


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#define SIZE 105

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char str[SIZE];

int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%s",&str);
		int L=strlen(str);
		int ret=0,now=0;
		while(now<L)
		{
			int to=now+4;
			while(to<L)
			{
				if(str[to-4]=='t'&&str[to-3]=='o'&&str[to-2]=='k'&&str[to-1]=='y'&&str[to]=='o') break;
				if(str[to-4]=='k'&&str[to-3]=='y'&&str[to-2]=='o'&&str[to-1]=='t'&&str[to]=='o') break;
				to++;
			}
			if(to<L)
			{
				ret++;
				now=to+1;
			}
			else break;
		}
		printf("%d\n",ret);
	}
	return 0;
}

Submission Info

Submission Time
Task A - 東京都
User yutaka1999
Language C++ (GCC 4.9.2)
Score 100
Code Size 809 Byte
Status AC
Exec Time 32 ms
Memory 976 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:25:18: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[105]’ [-Wformat=]
   scanf("%s",&str);
                  ^
./Main.cpp:22:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&T);
                ^
./Main.cpp:25:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",&str);
                   ^

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 31 ms 948 KB
20_noised_tokyoto.txt AC 30 ms 960 KB
99_teuchi.txt AC 32 ms 976 KB