zoukankan      html  css  js  c++  java
  • hdu4492 Mystery(不敢说很水,因为题没读懂)

    Mystery

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

    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
     
    因为是比赛时在WEBDIY上面做的,所以没看到题目,当时只觉得看不懂题,每一句话都读了好多遍硬是没发现怎么做,当时是队友做出来的,现在我又做了一下,看了题目就感觉暗藏玄机啊,题目就是秘密,你说这题是让读题意的么。。。。
    题意就是把那些编号加起来每一步都要输出对应的字母,是不是很水啊

    #include<stdio.h>
    #include<string.h>
    
    int main()
    {
    	int i,j,n,t,tt,p,len;
    	char s[600];
    	scanf("%d",&t);
    	while(t--)
    	{
    		scanf("%d",&tt);
    		getchar();
    		gets(s);
    		scanf("%d",&n);
    		p=0;
    		len=strlen(s);
    		printf("%d ",tt);
    		while(n--)
    		{
    			scanf("%d",&i);
    			p=(p+i)%len;
    			if(p<0)
    				p+=len;
    			putchar(s[p]);
    		}
    		printf("
    ");
    	}
    	return 0;
    }


  • 相关阅读:
    VMware ESXI 5.5 注册码
    NetScaler Active-Active模式
    Citrix NetScaler HA(高可用性)解析
    服务管理--systemctl命令
    CentOS7 安装 webgoat 7.1 简介
    Codefoces 723B Text Document Analysis
    Codefoces 723A The New Year: Meeting Friends
    ECJTUACM16 Winter vacation training #1 题解&源码
    信息学奥赛一本通算法(C++版)基础算法:高精度计算
    从零开始学算法:高精度计算
  • 原文地址:https://www.cnblogs.com/bbsno1/p/3253889.html
Copyright © 2011-2022 走看看