MaratonIME bot(暑假个人赛2(考虑不周) )

题目:
As you probably already know, all members of MaratonIME use Telegram to communicate, for its amazing web and desktop apps, its bots and, of course, its stickers.

As time goes by, members eventually graduate and leave the group, a sad event for all. Victor “Sena” Sena, a member of MaratonIME, is tired of countless goodbyes, and has decided to do something about the void that fills his noble soul.

Sena realized that people in Brazil are becoming more and more alike, expressing themselves in the same way, with expressions like “kk eae men”, “ata” and “zapzap”. The members of MaratonIME are very similar as well, but they use different expressions.

Peculiarly, whenever someone asks a question, everyone answers “7”. This is a tradition, from unknown origins, passed on by Germano “Germs” UnionFind. Besides, whenever someone says a sentence (that is not a question) and he mentions the dear member Gabriel “Sussu” Fernandes, all members yell in unison “AI SUSSU!”. For any other sentence that doesn’t fit any of these rules, the answer is “O cara é bom!” (this guy is good).

Figuring out these patterns, and using his incredible knowledge of software engineering, Sena decided to create a Telegram bot that simulates retired members of MaratonIME. He developed the whole platform, he just need the part that prints the answer for a given sentence, can you help him?

It has been agreed that a sentence is a question if it’s last character is ?. Also, it is only said that there was a mention to Sussu’s great name if one of the words in the sentence is exactly Sussu.

Input
The input consists of a single sentence, that is, a non-empty line, with space-separated words (strings with lower or upper case letters). The last character is always one among ., ! and ?. The line has at most 200 characters.

Output
Print what a MaratonIME member would answer to that sentence.

Examples
Input
Na viagem o Sussu comeu gelo achando que era gelatina.
Output
AI SUSSU!
Input
O Carlinhos zuou o Sussu!
Output
AI SUSSU!
Input
Bojack Horseman eh a melhor serie do Netflix.
Output
O cara é bom!
Input
Voce acredita na conjectura de Goldbach?
Output
7
Input
Eu estava andando e de repente sussu Susu SUSSU Sussussu Sussuzodia foi muito interessante.
Output
O cara é bom!

错因分析:1 判断Sussu的时候考虑不周,反复出错
2Sussu应考虑两种特殊位置:放中间的(s[i-1]应该是空格);放开头(是s[0]是存在的放在开头

  • List item

AC代码:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    int main()
    {
        char s[201];
        int len,f,i;
        while(gets(s)!=NULL)
      {
        len=strlen(s);
        for(i=0; i<len; i++)
        {
            if(s[len-1]=='?')
            {
                f=1;
                break;
            }
            else if((s[i-1]==' '||i==0)&&s[i]=='S'&&s[i+1]=='u'&&s[i+2]==
                    's'&&s[i+3]=='s'&&s[i+4]=='u')//当时反复出错,考虑错误,让i从i开始而不是i-1;忽略掉一种情况:Sussu放在开头的情况
            {
                if(s[i+5]==' '||s[i+5]=='.'||s[i+5]=='!'||s[i+5]==',')
                {
                    f=2;
                    break;
                }
            }
            else
            {
                f=3;
    
            }
        }
        if(f==1)printf("7\n");
        else if(f==2)printf("AI SUSSU!\n");
        else if(f==3)printf("O cara é bom!\n");
      }
        return 0;
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值