zoukankan      html  css  js  c++  java
  • hdu 5007 水题 (2014西安网赛A题)

    题意:出现Apple、iPod、iPhone、iPad时输出MAI MAI MAI!,出现Sony,输出SONY DAFA IS GOOD!

    Sample Input
    Apple bananaiPad lemon ApplepiSony
    233
    Tim cook is doubi from Apple
    iPhoneipad
    iPhone30 is so biiiiiiig Microsoft
    makes good App.

    Sample Output
    MAI MAI MAI!
    MAI MAI MAI!
    MAI MAI MAI!
    SONY DAFA IS GOOD!
    MAI MAI MAI!
    MAI MAI MAI!
    MAI MAI MAI!

     1 # include <iostream>
     2 # include <cstdio>
     3 # include <cstring>
     4 # include <string>
     5 # include <algorithm>
     6 # include <cmath>
     7 # include <queue>
     8 # define LL long long
     9 using namespace std ;
    10 
    11 
    12 int main ()
    13 {
    14     //freopen("in.txt","r",stdin) ;
    15     string s ;
    16     while(cin>>s)
    17     {
    18         int len = s.size() ;
    19         int i ;
    20         for (i = 0 ; i < len ; i++)
    21         {
    22             string a = s.substr(i,4) ;
    23             if (a == "iPad" ||a == "iPod")
    24                 cout<<"MAI MAI MAI!"<<endl ;
    25             else if (a == "Sony")
    26                 cout<<"SONY DAFA IS GOOD!"<<endl ;
    27             string b = s.substr(i, 5);
    28             if (b == "Apple")
    29                 cout<<"MAI MAI MAI!"<<endl ;
    30             string c = s.substr(i, 6);
    31             if (c == "iPhone")
    32                 cout<<"MAI MAI MAI!"<<endl ;
    33 
    34         }
    35     }
    36 
    37     return 0 ;
    38 }
    View Code
  • 相关阅读:
    [Leetcode] Longest Substring Without Repeating Characters
    [Leetcode] Clone Graph
    [Leetcode] LRU Cache
    行转列
    微信 Demo
    微信开发-step by stemp
    知识库
    SSAS GUID 添加 行计数,非重复计数 等 遇到的莫名其妙的问题
    javascript 前段MVVM 框架
    微信接口开发
  • 原文地址:https://www.cnblogs.com/mengchunchen/p/4603710.html
Copyright © 2011-2022 走看看