Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

why wa????

Posted by whus200731200092 at 2008-12-24 10:45:46 on Problem 1317
#include <stdio.h>
#include <string.h>
int main()
{
	int k,i,n;
	char ct[71];
	char pt[71];
	int cc[70]={0};
	int pc[70]={0};
	while(scanf("%d",&k),k)
	{
		scanf("%s",ct);
		n=strlen(ct);
		for(i=0;i<n;i++)
		{
			if(ct[i]=='.')
				cc[i]=27;
			else 
			{
				if(ct[i]=='_')
				cc[i]=0;
			    else cc[i]=ct[i]-'a'+1;
			}
		}
		for(i=0;i<n;i++)
		{
			if(cc[i]+i>27)
				pc[(k*i)%n]=cc[i]-28+i;
			else pc[(k*i)%n]=cc[i]+i;
		}
		for(i=0;i<n;i++)
		{
			if(pc[i]==0)
				pt[i]='_';
			else 
			{
				if(pc[i]==27)
				pt[i]='.';
			    else pt[i]=pc[i]+'a'-1;
			}
		}
		for(i=0;i<n;i++)
			printf("%c",pt[i]);
		printf("\n");
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator