coedforce Gym - 101597C (暴力匹配)

K. ACM
time limit per test
2.0 s
memory limit per test
64 MB
input
standard input
output
standard output

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.

Input

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.

Output

Print "Fun!" if the statement contains ACM, and "boring..." otherwise.

Examples
input
Copy
SWISSSUBREGIONALACMICPC
output
Copy
Fun!
input
Copy
XXXAXCXMXXX
output
Copy
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;
}

全部评论

相关推荐

M_bao:换个排版吧哥们,看着费劲
点赞 评论 收藏
分享
11-18 09:44
Java
小白也想要offer:简历别放洋屁,搞不还还放错了,当然你投外企除外,以上纯属个人观点
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务