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

方法比较笨,分享下代码

Posted by dingding1988 at 2010-02-06 19:28:21 on Problem 1298
#include<stdio.h>
int main()
{char str1[]="END";
 char str2[]="ENDOFINPUT";
 char s[10];
 char a[102];
 char b[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 char c[27]="VWXYZABCDEFGHIJKLMNOPQRSTU";
 int i,j,k;
 while(gets(s)&&strcmp(str2,s))
  {scanf("%c%c%c",&a[0],&a[1],&a[2]);
   i=3;
   while(!(a[i-3]=='E'&&a[i-2]=='N'&&a[i-1]=='D'))
    scanf("%c",&a[i++]);
	
	for(j=0;j<i-4;j++)
	 for(k=0;k<26;k++)
	   {if(a[j]==b[k])
	     {a[j]=c[k];break;}
	    }
   for(j=0;j<i-4;j++)
    printf("%c",a[j]);
   printf("\n");
   scanf("\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