HDU 4730 We Love MOE Girls(2013成都ネット試合、水題にサイン)

11597 ワード

We Love MOE Girls
Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 208    Accepted Submission(s): 157
Problem Description
Chikami Nanako is a girl living in many different parallel worlds. In this problem we talk about one of them.
In this world, Nanako has a special habit. When talking with others, she always ends each sentence with "nanodesu".
There are two situations:
If a sentence ends with "desu", she changes "desu"into "nanodesu", e.g. for "iloveyoudesu", she will say "iloveyounanodesu". Otherwise, she just add "nanodesu"to the end of the original sentence.
Given an original sentence, what will it sound like aften spoken by Nanako?
 
 
Input
The first line has a number T (T <= 1000) , indicating the number of test cases.
For each test case, the only line contains a string s, which is the original sentence.
The length of sentence s will not exceed 100, and the sentence contains lowercase letters from a to z only.
 
 
Output
For every case, you should output "Case #t: "at first, without quotes. The 
t is the case number starting from 1. Then output which Nanako will say.
 
 
Sample Input
2 ohayougozaimasu daijyoubudesu
 
 
Sample Output
Case #1: ohayougozaimasunanodesu Case #2: daijyoubunanodesu
 
 
Source
2013 ACM/ICPC Asia Regional Chengdu Online
 
 
Recommend
liuyiding
 
 
水が多すぎる
 1 /* ***********************************************
 2 Author        :kuangbin
 3 Created Time  :2013-9-15 0:04:49
 4 File Name     :G:\2013ACM  \2013   \2013     \1003.cpp
 5 ************************************************ */
 6 
 7 #pragma comment(linker, "/STACK:1024000000,1024000000")
 8 #include <stdio.h>
 9 #include <string.h>
10 #include <iostream>
11 #include <algorithm>
12 #include <vector>
13 #include <queue>
14 #include <set>
15 #include <map>
16 #include <string>
17 #include <math.h>
18 #include <stdlib.h>
19 #include <time.h>
20 using namespace std;
21 #define REP(I, N) for (int I=0;I<int(N);++I)
22 #define FOR(I, A, B) for (int I=int(A);I<int(B);++I)
23 #define DWN(I, B, A) for (int I=int(B-1);I>=int(A);--I)
24 #define REP_1(I, N) for (int I=1;I<=int(N);++I)
25 #define FOR_1(I, A, B) for (int I=int(A);I<=int(B);++I)
26 #define DWN_1(I, B, A) for (int I=int(B);I>=int(A);--I)
27 #define REP_C(I, N) for (int N____=int(N),I=0;I<N____;++I)
28 #define FOR_C(I, A, B) for (int B____=int(B),I=A;I<B____;++I)
29 #define DWN_C(I, B, A) for (int A____=int(A),I=B-1;I>=A____;--I)
30 #define REP_1_C(I, N) for (int N____=int(N),I=1;I<=N____;++I)
31 #define FOR_1_C(I, A, B) for (int B____=int(B),I=A;I<=B____;++I)
32 #define DWN_1_C(I, B, A) for (int A____=int(A),I=B;I>=A____;--I)
33 #define DO(N) while(N--)
34 #define DO_C(N) int N____ = N; while(N____--)
35 #define TO(i, a, b) int s_=a<b?1:-1,b_=b+s_;for(int i=a;i!=b_;i+=s_)
36 #define TO_1(i, a, b) int s_=a<b?1:-1,b_=b;for(int i=a;i!=b_;i+=s_)
37 #define SQZ(I, J, A, B) for (int I=int(A),J=int(B)-1;I<J;++I,--J)
38 #define SQZ_1(I, J, A, B) for (int I=int(A),J=int(B);I<=J;++I,--J)
39 
40 
41 int main()
42 {
43     //freopen("in.txt","r",stdin);
44     //freopen("out.txt","w",stdout);
45     int T;
46     scanf("%d",&T);
47     string str;
48     int iCase = 0;
49     while(T--)
50     {
51         iCase++;
52         cin>>str;
53         int n = str.length();
54         if(n >= 4 && str[n-4] == 'd' && str[n-3] == 'e' && str[n-2] == 's' && str[n-1] == 'u')
55         {
56             str[n-4] = 'n';
57             str[n-3] = 'a';
58             str[n-2] = 'n';
59             str[n-1] = 'o';
60             str += "desu";
61         }
62         else str += "nanodesu";
63         printf("Case #%d: ",iCase);
64         cout<<str<<endl;
65     }
66     return 0;
67 }