【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

相關文章
相關標籤/搜索