您的位置:首页 > 理论基础 > 计算机网络

HDU 4730 We Love MOE Girls (2013成都网络赛,签到水题)

2013-09-15 00:13 453 查看

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


[align=left]Problem Description[/align]
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?

[align=left]Input[/align]
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.

[align=left]Output[/align]
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.

[align=left]Sample Input[/align]

2
ohayougozaimasu
daijyoubudesu

[align=left]Sample Output[/align]

Case #1: ohayougozaimasunanodesu
Case #2: daijyoubunanodesu

[align=left]Source[/align]
2013 ACM/ICPC Asia Regional Chengdu Online

[align=left]Recommend[/align]
liuyiding

太水了

/* ***********************************************
Author        :kuangbin
Created Time  :2013-9-15 0:04:49
File Name     :G:\2013ACM练习\2013网络赛\2013成都网络赛\1003.cpp
************************************************ */

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
#define REP(I, N) for (int I=0;I<int(N);++I)
#define FOR(I, A, B) for (int I=int(A);I<int(B);++I)
#define DWN(I, B, A) for (int I=int(B-1);I>=int(A);--I)
#define REP_1(I, N) for (int I=1;I<=int(N);++I)
#define FOR_1(I, A, B) for (int I=int(A);I<=int(B);++I)
#define DWN_1(I, B, A) for (int I=int(B);I>=int(A);--I)
#define REP_C(I, N) for (int N____=int(N),I=0;I<N____;++I)
#define FOR_C(I, A, B) for (int B____=int(B),I=A;I<B____;++I)
#define DWN_C(I, B, A) for (int A____=int(A),I=B-1;I>=A____;--I)
#define REP_1_C(I, N) for (int N____=int(N),I=1;I<=N____;++I)
#define FOR_1_C(I, A, B) for (int B____=int(B),I=A;I<=B____;++I)
#define DWN_1_C(I, B, A) for (int A____=int(A),I=B;I>=A____;--I)
#define DO(N) while(N--)
#define DO_C(N) int N____ = N; while(N____--)
#define TO(i, a, b) int s_=a<b?1:-1,b_=b+s_;for(int i=a;i!=b_;i+=s_)
#define TO_1(i, a, b) int s_=a<b?1:-1,b_=b;for(int i=a;i!=b_;i+=s_)
#define SQZ(I, J, A, B) for (int I=int(A),J=int(B)-1;I<J;++I,--J)
#define SQZ_1(I, J, A, B) for (int I=int(A),J=int(B);I<=J;++I,--J)

int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T;
scanf("%d",&T);
string str;
int iCase = 0;
while(T--)
{
iCase++;
cin>>str;
int n = str.length();
if(n >= 4 && str[n-4] == 'd' && str[n-3] == 'e' && str[n-2] == 's' && str[n-1] == 'u')
{
str[n-4] = 'n';
str[n-3] = 'a';
str[n-2] = 'n';
str[n-1] = 'o';
str += "desu";
}
else str += "nanodesu";
printf("Case #%d: ",iCase);
cout<<str<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: