| ||||||||||
| 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 | |||||||||
Re:好象我程序的答案没错啊,怎么还是提交不了In Reply To:好象我程序的答案没错啊,怎么还是提交不了 Posted by:lbcharry at 2005-05-18 12:57:29 > #include <iostream.h>
> #include <ctype.h>
> #include <stdio.h>
>
>
> int changetoint(char c)
> {
> if(isalpha(c))
> return (c-'a'+1);
> else if(c=='_')return 0;
> return 27;
> }
> char changetochar(int x)
> {
> if(x==0)return '_';
> else if(x==27) return '.';
> return char(x-1+'a');
> }
> int fun(int x,int i)
> {
> if((x+i)>27)
> return (i+x-28);
> return (x+i);
> }
>
> void conver(char s[],char str[],int n,int k)
> {
> int i,x,y;
> if(n==0)return;
> for(i=0;i<n;i++)
> {
> if(s[i]==' ')continue;
> x=changetoint(s[i]);
> y=fun(x,i);
> str[(k*i)%n]=changetochar(y);
> }
> }
>
>
>
>
> int main()
> {
> int k,n,j=0,num[10];
> int i;
> char s[30][71],str[30][71],c;
> do{
> i=0;
> scanf("%i",&k);
>
> while(c=getchar())
> {
> if(c==' ')continue;
> if(c=='\n')break;
> s[j][i++]=c;
>
> }
> // cout<<"n="<<i<<endl;
> n=i;
> num[j]=i;
> conver(s[j],str[j],n,k);
> j++;
> }while(k);
> for(int t=0;t<j-1;t++)
> {
> for(i=0;i<num[t];i++)
> cout<<str[t][i];
> cout<<endl;
> }
> return 0;
> }
> 哪为高人来帮忙看看!!!!
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator