Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

hdu 2526 浪漫手机

$
0
0

让人蛋疼的题意

每行乐谱的最前面和最后面默认为0

 

 

 

#include<stdio.h>
#include<string.h>
int a[120];
int main()
{
	int i,j,k,t,n,c,len;
	char s[1000],s1[1000];
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		for(i=1;i<=8;i++)
		{
			scanf("%d%d",&k,&c);
			a[k]=c;
		}
		scanf("%s",s+1);
		s[0]='0';
		len=strlen(s+1);
		puts(s+1);
		s[len+1]='0';
		s[len+2]='\0';
		for(i=1;i<n;i++)
		{
			
			s1[0]='0';
			for(j=1;j<=len;j++)
			{
				k=(s[j-1]-'0')*100+(s[j]-'0')*10+(s[j+1]-'0');
				s1[j]='0'+a[k];
			}
			s1[len+1]='\0';
			puts(s1+1);
			s1[len+1]='0';
			s1[len+2]='\0';
			strcpy(s,s1);
		}
		
	}
	return 0;
}


 

作者:aixiaoling1314 发表于2013-5-5 20:39:17 原文链接
阅读:43 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>