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
  • 相关阅读:
    天天生鲜(一) 表设计
    linux 分区管理
    linux rpm包管理 yum管理
    linux命令
    linux IP 网关配置
    Django的JWT机制工作流程
    django CBV模式源码执行过程
    django 网站上传资源的显示与配置
    图片服务器的架构演进
    php获取指定目录下的所有文件列表
  • 原文地址:https://www.cnblogs.com/mengchunchen/p/4603710.html
Copyright © 2011-2022 走看看