zoukankan      html  css  js  c++  java
  • Kaitou Kid The Phantom Thief (1)(字符串,简单)

    Kaitou Kid - The Phantom Thief (1)

    Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 1498    Accepted Submission(s): 666

    Problem Description
    Do you know Kaitou Kid? In the legend, Kaitou Kid is a master of disguise, and can take on the voice and form of anyone. He is not an evil person, but he is on the wrong side of the law. He's the very elusive phantom thief who never miss his prey although he always uses word puzzles to announce his targets before action.



    You are the leader of a museum. Recently, you get several priceless jewels and plan to hold an exhibition. But at the moment, you receive Kid's word puzzle... Fortunately, It seems Kid doesn’t want to trouble you, and his puzzle is very easy. Just a few minutes, You have found the way to solve the puzzle:

    (1) change 1 to 'A', 2 TO 'B',..,26 TO 'Z'
    (2) change '#' to a blank
    (3) ignore the '-' symbol, it just used to separate the numbers in the puzzle
     
    Input
    The first line of the input contains an integer C which means the number of test cases. Then C lines follow. Each line is a sentence of Kid’s word puzzle which is consisted of '0' ~ '9' , '-' and '#'. The length of each sentence is no longer than 10000.
     
    Output
    For each case, output the translated text.
     
    Sample Input
    4 9#23-9-12-12#19-20-5-1-12#1-20#12-5-1-19-20#15-14-5#10-5-23-5-12 1-14-4#12-5-1-22-5#20-8-5#13-21-19-5-21-13#9-14#20#13-9-14-21-20-5-19 1-6-20-5-18#20-8-5#15-16-5-14-9-14-7#15-6#20-8-5#5-24-8-9-2-9-20-9-15-14 7-15-15-4#12-21-3-11
     
    Sample Output
    I WILL STEAL AT LEAST ONE JEWEL AND LEAVE THE MUSEUM IN T MINUTES AFTER THE OPENING OF THE EXHIBITION GOOD LUCK
     
    Author
    LL
     
    Source
     
    Recommend
    wangye
     
     1 #include <iostream>
     2 #include <cstdio>
     3 #include <cmath>
     4 #include <cstring>
     5 #include <algorithm>
     6 #define LL long long
     7 #define maxint 2147483647
     8 #define maxll 9223372036854775807
     9 #define dg cout << "Here!" << endl;
    10 using namespace std;
    11 
    12 int main()
    13 {
    14     int C, i, len;
    15     char s[10001], ch;
    16     scanf("%d", &C);
    17     while(C--)
    18     {
    19         scanf("%s", s);
    20         len = strlen(s);
    21         for(i = 0; i < len; i++)
    22         {
    23             if(s[i] >= '0' && s[i] <= '9')
    24             {
    25                 if(s[i+1] == '-' || s[i+1] == '\0')
    26                 {
    27                     //ch = s[i] + 'A' - '1';
    28                     putchar(s[i] + 'A' - '1');
    29                     i++;
    30                 }
    31                 else if(s[i+1] >= '0' && s[i+1] <='9')
    32                 {
    33                     //ch = (s[i] - '0')*10 + s[i+1] - '0' + 'A' - 1;
    34                     putchar((s[i] - '0')*10 + s[i+1] - '0' + 'A' - 1);
    35                     i++;
    36                 }
    37                 else putchar(s[i] + 'A' - '1');
    38             }
    39             else if(s[i] == '#')
    40                 putchar(' ');
    41 
    42         }
    43         puts("");
    44     }
    45     return 0;
    46 }
  • 相关阅读:
    用UIScrollView产生视差效果
    梦幻星空动画
    固定UIScrollView滑动的方向
    关于UIScrollView有些你很难知晓的崩溃情形
    使用一元二次方程做实时动画
    RDMBorderedButton
    如何查看开发者账号何时到期
    [翻译] TGLStackedViewController
    【转】Tomcat配置文件入门
    Servlet 工作原理解析
  • 原文地址:https://www.cnblogs.com/cszlg/p/2910479.html
Copyright © 2011-2022 走看看