记录编号 258568 评测结果 AAAAAAAAAA
题目名称 [NOIP 2007]字符串的展开 最终得分 100
用户昵称 GravatarRiolu 是否通过 通过
代码语言 C++ 运行时间 0.003 s
提交时间 2016-05-06 20:08:09 内存使用 0.32 MiB
显示代码纯文本
/*=========================================*
  * Auther: Riolu
  * PID: 48
  * Time: 2016.5.6
  * ©Copyright 2016 Riolu. All Rights Reserved.
  *=========================================*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;

int main()
{
	freopen("expand.in","r",stdin);
	freopen("expand.out","w",stdout);
	int p1,p2,p3,z,i,j;
	string s;
	cin>>p1>>p2>>p3;
	cin>>s;
	int l = s.size();
	for(z=0;z<l;z++)
	{
		if(s[z]!='-')
		{
			cout<<s[z];
			continue;
			}
		
		if(
			(s[z]=='-')
			&&(z==0 || z==l-1 )
			)
		{
			cout<<'-';
			continue;
			}
		
		if(
			((s[z-1]>='0'&&s[z-1]<='9'&&s[z+1]>='0'&&s[z+1]<='9'&&s[z-1]>=s[z+1])
			||(s[z-1]>='a'&&s[z-1]<='z'&&s[z+1]>='a'&&s[z+1]<='z'&&s[z-1]>=s[z+1])
			||(s[z-1]>='0'&&s[z-1]<='9'&&s[z+1]>='a'&&s[z+1]<='z')
			||(s[z-1]>='a'&&s[z-1]<='z'&&s[z+1]>='0'&&s[z+1]<='9'))
			||(s[z-1]=='-')
			||(s[z+1]=='-')
			)
		{
			cout<<'-';
			continue;
			}
		
		if( (s[z-1]>='0')&&(s[z-1]<='9')&&(s[z+1]>='0')&&(s[z+1]<='9') )
		{
			if(p1==3)
			{
				for(i=s[z-1]+1;i<=s[z+1]-1;i++)
					for(j=1;j<=p2;j++)
						cout<<'*';
				continue;	
				}
			if(p3==1)
			{
				for(i=s[z-1]+1;i<=s[z+1]-1;i++)
					for(j=1;j<=p2;j++)
						cout<<(char)(i);
				continue;
				}
			for(i=s[z+1]-1;i>=s[z-1]+1;i--)
				for(j=1;j<=p2;j++)
					cout<<(char)(i);
			}
		if( (s[z-1]>='a')&&(s[z-1]<='z')&&(s[z+1]>='a')&&(s[z+1]<='z') )
		{
			
			if(p1==3)
			{
				for(i=s[z-1]+1;i<=s[z+1]-1;i++)
					for(j=1;j<=p2;j++)
						cout<<'*';
				continue;	
				}
				
			
			if(p1==1)
			{
				if(p3==1)
				{
					for(i=s[z-1]+1;i<=s[z+1]-1;i++)
						for(j=1;j<=p2;j++)
							cout<<(char)(i);
					continue;
					}
				
				for(i=s[z+1]-1;i>=s[z-1]+1;i--)
					for(j=1;j<=p2;j++)
						cout<<(char)(i);
					continue;
				}
			
			if(p3==1)
				{
					for(i=s[z-1]+1;i<=s[z+1]-1;i++)
						for(j=1;j<=p2;j++)
							cout<<(char)(i-32);
					continue;
					}
				for(i=s[z+1]-1;i>=s[z-1]+1;i--)
					for(j=1;j<=p2;j++)
						cout<<(char)(i-32);
					continue;
				}
			}
		
	return 0;
}