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;
    }

  • 相关阅读:
    Spring Boot全日志设置
    SpringBoot整合Quartz
    Kubernetes网络方案的三大类别和六个场景
    微服务化之缓存的设计
    金融创新业务基于容器云的微服务化实践
    致传统企业朋友:不够痛就别微服务,有坑 (1)
    致传统企业朋友:不够痛就别微服务,有坑 (2)
    The Beam Model:Stream & Tables翻译(上)
    细说Mammut大数据系统测试环境Docker迁移之路
    [译] 关于 SPA,你需要掌握的 4 层 (1)
  • 原文地址:https://www.cnblogs.com/GODLIKEING/p/3321617.html
Copyright © 2011-2022 走看看