Programming contests are fun! So fun in fact, that you find yourself browsing online through hundreds of programming-related tasks, checking if they are about competitive programming. As quite a few of those tasks were not what you were looking for, you were wondering if you could write a program that classifies the problems for you!
You figured out that the following classification works every time: If the task description mentions "ACM", then the task is about competitive programming and will thus be very fun to solve. Otherwise, the task is not.
You are given the task description, consisting of only uppercase letters of the Latin alphabet (A through Z). It is guaranteed that there will be at least one and at most 106 characters.
Print "Fun!" if the statement contains ACM, and "boring..." otherwise.
SWISSSUBREGIONALACMICPC
Fun!
XXXAXCXMXXX
boring...
给你一个字符串~让你看看这里面有没有’ACM‘~~
不过要注意的一个地方是~你不能直接用strlen(m)-2;来作为某个参数;因为这样会引起奇怪的~~变化(strlen(“m”)-2是一个奇怪的数);
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char m[1000100];
int main()
{
scanf("%s", m);
int spot = 0;
if (strlen(m) == 1)
{
printf("boring...\n");
return 0;
}
for (int s = 0; s < strlen(m)-2; s++)
{
if (m[s] == 'A'&&m[s+1]=='C'&&m[s+2]=='M')
{
spot = 1;
break;
}
}
if (spot)
{
printf("Fun!\n");
}
else
{
printf("boring...\n");
}
return 0;
}