【HDOJ】5007 Post Robot

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

【报告】spa

       闲来无事刷水题……get

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

【程序】程序

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

相关文章
相关标签/搜索