本文主要是介绍HDU 5007 Post Robot(西安网络赛A题),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
HDU 5007 Post Robot
题目链接
就一个签到题,今天也是手速略慢
代码:
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
using namespace std;string str;int main() {while (getline(cin, str)) {int n = str.length();for (int i = 0; i < n; i++) {if (i <= n - 6 && str[i] == 'i' && str[i + 1] == 'P' && str[i + 2] == 'h' && str[i + 3] == 'o' && str[i + 4] == 'n' && str[i + 5] == 'e') printf("MAI MAI MAI!\n");else if (i <= n - 5 && str[i] == 'A' && str[i + 1] == 'p' && str[i + 2] == 'p' && str[i + 3] == 'l' && str[i + 4] == 'e')printf("MAI MAI MAI!\n");else if (i <= n - 4 && str[i] == 'i' && str[i + 1] == 'P' && str[i + 2] == 'o' && str[i + 3] == 'd')printf("MAI MAI MAI!\n");else if (i <= n - 4 && str[i] == 'i' && str[i + 1] == 'P' && str[i + 2] == 'a' && str[i + 3] == 'd')printf("MAI MAI MAI!\n");else if (i <= n - 4 && str[i] == 'S' && str[i + 1] == 'o' && str[i + 2] == 'n' && str[i + 3] == 'y')printf("SONY DAFA IS GOOD!\n");}}return 0;
}
这篇关于HDU 5007 Post Robot(西安网络赛A题)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!