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

全部评论

相关推荐

05-23 20:31
已编辑
武汉大学 Java
内向的柠檬精在研究求...:注意把武大标粗标大 本地你俩不是乱杀
实习进度记录
点赞 评论 收藏
分享
06-04 09:27
门头沟学院 Java
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
06-27 15:07
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务