【HDOJ】5007 Post Robot

【题目】 http://acm.hdu.edu.cn/showproblem.php?pid=5007

【报告】

       闲来无事刷水题……

       直接暴力判断是否相同就行了,连KMP都不用。简单粗暴。

【程序】

#include
#include
#include
#include
#include
using namespace std;
const int Len = 10000;
char str[Len];
inline bool check(char a[],char b[])
{
    if (strlen(a)
    for (;*b;a++,b++)
        if (*a!=*b) return false;
    return true;
}
int main()
{
    while (scanf("%s",str)!=EOF)
    {
      //  cout << str << endl;
        for (int i=0;i
            if (check(str+i,"Apple")||check(str+i,"iPhone")||check(str+i,"iPod")||check(str+i,"iPad"))
                printf("MAI MAI MAI!\n");
            else if (check(str+i,"Sony"))
                printf("SONY DAFA IS GOOD!\n");
    }
    return 0;
}

 

posted @ 2014-10-24 14:09  为美好世界献上珂学  阅读(132)  评论(0编辑  收藏  举报