zoukankan      html  css  js  c++  java
  • HDU 4492 Mystery (水题)

    Mystery

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 141    Accepted Submission(s): 75

    Input
    The first line of input contains a single integer P, (1 <= P <= 1000), which is the number of data sets that follow. Each data set consists of several lines. Each data set should be processed identically and independently.
    The first line of each data set contains an integer D which is the data set number. The second line contains no more than the 93 distinct printable ASCII characters. The third line contains an integer, N (1 <= N <=512 ), which is the number of integers on the next (fourth) line of the dataset. Each integer on the fourth line is in the range -X to X where X is the number of characters on the second line minus 1.
     
    Output
    For each data set there is one correct line of output. It contains the data set number (D) followed by a single space, followed by a string of length N made of the characters on the second line of the input data set.
     
    Sample Input
    4 1 MAC 3 1 1 1 2 IW2C0NP3OS 1RLDFA 22 0 3 3 -3 7 -8 2 7 -4 3 8 7 4 1 1 -4 5 2 5 -6 -3 -4 3 G.IETSNPRBU 17 2 4 5 -6 -1 -3 -2 -4 -4 1 -1 5 -3 4 1 -2 4 4 PIBN MRDSYEO 16 -4 4 -1 4 5 3 -5 4 -3 -3 -2 -5 -5 -3 1 3
     
    Sample Output
    1 ACM 2 ICPC 2013 WORLD FINALS 3 IN ST. PETERSBURG 4 SPONSORED BY IBM
     
    Source
     
    Recommend
    liuyiding
     
     
    刷了下HDU的最后一题,竟然是非常水的水题,MARK下
    #include <stdio.h>
    #include <iostream>
    #include <algorithm>
    #include <string.h>
    using namespace std;
    char str[100];
    int main()
    {
        int T;
        int D;
        scanf("%d",&T);
        while(T--)
        {
            scanf("%d%*c",&D);//跳过后面的一个换行符
            printf("%d ",D);
            cin.getline(str,100);
            int len=strlen(str);
            int n;
            int t=0;
            scanf("%d",&n);
            int x;
            while(n--)
            {
                scanf("%d",&x);
                t+=x;
                t=(t+len)%len;
                printf("%c",str[t]);
            }
            printf("\n");
        }
        return 0;
    }
    人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想
  • 相关阅读:
    Shell中 调用/引用/包含 另外的脚本文件的两种方法
    CentOS6.3安装MongoDB2.2 及 安装PHP的MongoDB客户端
    Linux下忘记MySQL的root密码的解决方法
    计算机图形学 椭圆的扫描转换(3)
    实现app上对csdn的文章查看,以及文章中图片的保存 (制作csdn app 完结篇)
    linux 查看并终止进程
    ios7自带的晃动效果
    HDU--1533--Going Home--KM算法
    C语言中怎么求动态数组大小
    myeclipse断点调试
  • 原文地址:https://www.cnblogs.com/kuangbin/p/2939471.html
Copyright © 2011-2022 走看看