hdu 4492 Mystery
来源:互联网 发布:丹尼格林知乎 编辑:程序博客网 时间:2024/05/22 04:32
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
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
这道题只要找到规律了就好做了,反正就是累加,你让我说怎么累加,我说不清,看一下代码就懂了
AC代码:
#include<stdio.h>#include<string.h>char a[100];int b[513];int main(){int p,q,n,s,len,temp,i;scanf("%d",&p);while(p--){scanf("%d",&q);getchar();gets(a);scanf("%d",&n);for(i=0;i<n;i++)scanf("%d",&b[i]);s=0;len=strlen(a);printf("%d ",q);for(i=0;i<n;i++){s+=b[i];temp=(s+len*n)%len;//注意这里一定要加上n*len,不然的话temp可能为负printf("%c",a[temp]);}printf("\n");}return 0;}
- hdu 4492 Mystery
- hdu 4492 Mystery
- HDU 4492 Mystery (模拟)
- UVALive 6181|HDU 4492|Mystery|猜题意|模拟
- mystery
- HDU4492:Mystery
- the mystery of erasure
- UVALive 6181 Mystery (水
- codechef Party Mystery
- hackerrank The Love-Letter Mystery
- Windows File Sharing: Facing The Mystery
- Inner classes in Java, the mystery within.
- The Mystery of OBIEE Bridge Tables
- The Mystery of the Duqu Framework
- The Mystery of the Duqu Framework
- Shining a Light on Mystery Shopping_53861.
- I.SPY.Mystery.v1.0-T
- Google Reader Co-Founder Announces New Mystery Project
- STL中迭代器与指针的区别
- VIJOS P1476 旅游规划(csapc)
- 看完这个,我只能说,我错了。为了明天,加油。
- hdu 4488 Faulhaber’s Triangle
- MyEclipse自动跳出ThreadPoolExecutor的debug窗口解决方法
- hdu 4492 Mystery
- Oracle中关于时间的to_char和to_date
- java线程系列---Runnable和Thread的区别
- 越努力,越幸运
- 编译 hive
- 暗黑3 外挂开发资料
- 黑马程序员—Java基础加强—(泛型)
- GridView的监听,选择,美化等详解<一>
- 关于打印一个有趣的数字图形的问题