NOJ [1263] All Kill

  • 问题描述
  • Now is the Z country's extraordinary period,Ning x City broke out in a procession, the relevant departments accidentally get some data, by analysis, 
    this is M country' ciphertext. . . Now, we get the correct way to decryption .
    Now,you have to do it, for each of the ciphertext, presence a number x of corresponding , represents the originaltext. moved to the right of the x-bit to get 
    ciphertext, and now output correct the original.If you donn't,you will be kill !!!

  • 输入
  • This problem contains several cases.
    The first line of each case is the ciphertext(the length < 100000).
    The next line is the number,that is every ciphertext'x.
  • 输出
  • printf the originaltext. You have to leave a blank line between each two cases.


    一开始把Case写成了CASE。。。。。。大家不要犯这种低级错误啊


    #include<stdio.h>
    #include<string.h>
    
    char ciphertext[100010];
    char number_x[100010];
    char originaltext[100010];
    int main()
    {
    	int p=1;
    	while(~scanf("%s",ciphertext))
    	{
    		scanf("%s",number_x);
    		int len=strlen(ciphertext),i;
    		for(i=0;i<len;i++)
    		{
    			if(ciphertext[i]>='a' && ciphertext[i]<='z')//小写字母
    			{
    				char c=ciphertext[i]-'a'-(number_x[i]-'0')+'a';
    				if(c>='a')
    				  originaltext[i]=c;
    		        else
    		          originaltext[i]='z'-('a'-c)+1;
    			} 
    			else if(ciphertext[i]>='A' && ciphertext[i]<='Z')
    			{
    				char c=ciphertext[i]-'A'-(number_x[i]-'0')+'A';
    				if(c>='A')
    				  originaltext[i]=c;
    		        else
    		          originaltext[i]='Z'-('A'-c)+1;
    			}
    		}
    		originaltext[len]='\0';
    		if(p>1)
    		  printf("\n");       
    		printf("Case %d: %s\n",p,originaltext);
    		p++;
    	}
    	return 0;
    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值