zoukankan      html  css  js  c++  java
  • HDU 4730 We Love MOE Girls

    We Love MOE Girls

    Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 68    Accepted Submission(s): 55


    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
     
    Recommend
    liuyiding
     
     
    思路:水题
     
    代码:
    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <cstdlib>
    #include <algorithm>
    #include <queue>
    using namespace std;
    int t;
    int length;
    char strr[110];
    char change_str[10] = "nanodesu";
    int main()
    {
        scanf("%d",&t);
        for(int j = 1;j <= t;j ++)
        {
            memset(strr,0,sizeof(strr));
            scanf("%s",strr);
            length = strlen(strr);
            printf("Case #%d: ",j);
            int a = length - 1;int b = length - 2;int c = length - 3;int d = length - 4;
            if(strr[a] == 'u' && strr[b] == 's' && strr[c] == 'e' && strr[d] == 'd')
            {
                for(int i = 0;i < length - 4;i ++)
                    printf("%c",strr[i]);
                printf("%s ",change_str);
            }
            else
            {
                printf("%s%s ",strr,change_str);
            }
        }
        return 0;
    }

  • 相关阅读:
    阿里云HBase携X-Pack再进化,重新赋能轻量级大数据平台
    CVE漏洞—PHPCMS2008 /type.php代码注入高危漏洞预警
    傻瓜神经网络入门指南
    一起来看 rxjs
    阿里云ACE共创空间——MQ消息队列产品测试
    阿里毕玄:技术人应如何选择职业发展路线?
    MyBatsi学习
    UEditor学习
    fastJson在java后台转换json格式数据探究(二)--处理数组/List/Map
    JS获取当前年份月
  • 原文地址:https://www.cnblogs.com/GODLIKEING/p/3321617.html
Copyright © 2011-2022 走看看