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 |
可以AC。WA的同学考虑一下在除大写字母以外的输入(标点之类)的情况下的输出。#include <iostream> using namespace std; char trans( char c ) { if ( c <= 'Z' && c >= 'A' )return 65 + ( c - 44 ) % 26; return c; } int main() { char input[100]; while (1) { gets(input); if ( !strcmp( input, "START" )|| !strcmp( input, "END" ) ); else if ( !strcmp( input, "ENDOFINPUT" ) )break; else { int i = 0; while ( i < strlen(input) )input[i] = trans( input[i++] ); printf("%s\n", input); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator