Sicily 14513. Aaah!

港控/mmm° 2022-08-08 13:40 154阅读 0赞

















14513. Aaah!



 
     












     
 



Time Limit: 1sec    Memory Limit:256MB


Description


Jon Marius shouted too much at the recent Justin Bieber concert, and now needs to go to the doctor because of his sore throat. The doctor’s instructions are to say “aaah”. Unfortunately, the doctors sometimes need Jon Marius to say “aaah” for a while, which Jon Marius has never been good at. Each doctor requires a certain level of “aah” – some require “aaaaaah”, while others can actually diagnose his throat with just a “h”. (They often diagnose wrongly, but that is beyond the scope of this problem.) Since Jon Marius does not want to go to a doctor and have his time wasted, he wants to compare how long he manages to hold the “aaah” with the doctor’s requirements. (After all, who wants to be all like “aaah” when the doctor wants you to go “aaaaaah”?)


Each day Jon Marius calls up a different doctor and asks them how long his “aaah” has to be. Find out if Jon Marius would waste his time going to the given doctor.




Input


The input consists of two lines. The first line is the “aaah” Jon Marius is able to say that day. The second line is the “aah” the doctor wants to hear. Only lowercase ’a’ and ’h’ will be used in the input, and each line will contain between 0 and 999 ’a’s, inclusive, followed by a single ’h’.


The input contains multiple test cases. End of file (EOF) indicates the end of input.




Output


Output “go” if Jon Marius can go to that doctor, and output “no” otherwise.




Sample Input


 Copy sample input to clipboard


  1. aaah
    aaaaah
    aaah
    ah



Sample Output


  1. no
    go


Problem Source: 2015年每周一赛第十场—省赛模拟赛I



  1. #include<stdio.h>
    #include<string>
    #include<iostream>
    using namespace std;
    string s1,s2;
    const int INF = 4294967295; //表示找不到
    int main(){
    while(cin>>s1>>s2){
    int ans = s1.find(s2);
    if(ans >= 0)printf(“go\n”);
    else printf(“no\n”);
    }
    }







发表评论

表情:
评论列表 (有 0 条评论,154人围观)

还没有评论,来说两句吧...

相关阅读

    相关 sicily 1029

    思路:首先创建两个函数operate() 和cycle(),其中operate()求得两个大数之和,cycle()将数组向后平移一位。首先初始化数组num,数组num存储兔子的

    相关 [sicily] 1001. Alphacode

    ![这里写图片描述][20160511210803993] 题目大意: 假设有一规则:’A’ 设为1,’B’设为2,以此类推, ‘Z’设为26。按照这个规则给一串英文字母