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

全部评论

相关推荐

寿命齿轮:实习就一段还拉了,项目一看就不是手搓,学历也拉了,技术栈看着倒是挺好,就是不知道面试表现能咋样。 不过现在才大三,争取搞两端大厂实习,或者一个纯个人项目+一段大厂,感觉秋招还是未来可期。
投递美团等公司10个岗位
点赞 评论 收藏
分享
11-24 19:04
已编辑
湖南工商大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务