| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
why wa????#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator