標籤:資料 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的粉絲