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

可以AC。WA的同学考虑一下在除大写字母以外的输入(标点之类)的情况下的输出。

Posted by Brush at 2009-04-01 14:23:06 on Problem 1298
#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:
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