HDU---BigZhuGod的粉絲

來源:互聯網
上載者:User

標籤:資料   content   char s   style   長度   wow   include   tput   break   

Problem Description真正的粉絲,是不需要題目描述的^_^。 Input第一行輸入資料群組數T(1≤T≤100)。
接下來T行,每行一個有格式的字串,詳見範例,字串長度不超過1000。
 Output真正的粉絲,就算我不給出輸出格式,還是可以AC這道題目。
^_^ Sample Input5I am BigZhuGod?I am BigZhuGod.I am BigZhuGod!I am BigZhuGod!!!I am BigZhuGod!!!!! Sample Output-_- Orz Wow! Wooow! Wooooow!

 這題還是比較水的...

但是在ac的過程中遇到了幾個小問題...

輸入帶空格的字串方法: string s; getline(cin, s) 或者 char s[100]; fgets(s, 100, stdin);

好像其他方法都會忽略空格,然後把空格後面的字元當做下一個字串...

#include<iostream>#include<string>#include<cstdio>using namespace std;#define maxn 1005int main(){    int T;    cin >> T;    T = T+1;    while(T--){        string s;        getline(cin, s);        int len = s.size();        switch(s[len-1]){            case ‘?‘ :printf("-_-\n");break;            case ‘.‘ :printf("Orz\n");break;            case ‘!‘ :{                printf("W");                int flag = 0;                for(int i=0; i<len; i++){                    if(s[i] == ‘!‘) flag++;                }                for(int j=0; j<flag; j++){                    printf("o");                }                printf("w!\n");                break;            }         }    }        return 0;}

 

HDU---BigZhuGod的粉絲

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.