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
  • 相关阅读:
    事务和异常处理
    普通三层结构示例
    Viewstate与Static
    oracle 9i 的数据类型
    XSD数据集
    ASP.NET中的错误处理和程序优化
    PL/SQL程序设计
    ASP.NET 2.0中的异步页面
    Oracle中RowNum的用法
    .NET单元测试
  • 原文地址:https://www.cnblogs.com/mengchunchen/p/4603710.html
Copyright © 2011-2022 走看看