1298 The Hardest Problem Ever

时间:2023-03-10 03:28:37
1298 The Hardest Problem Ever

题目链接:http://poj.org/problem?id=1298

思路分析:水题,字符偏移求解,注意字符串输入问题即可。

代码如下:

#include <iostream>
#include <string>
using namespace std; const int MAX_N = + ;
char A[MAX_N]; int main()
{
int Len;
char Tmp[]; while ( scanf( "%s", Tmp )!= EOF )
{
if( strcmp( Tmp, "ENDOFINPUT" ) == )
break; getchar( );
gets( A );
Len = strlen( A );
for ( int i = ; i < Len; ++i )
{
if ( A[i] >= 'A' && A[i] <= 'Z' )
A[i] = (( ( A[i]-'A') - + ) % ) + 'A';
}
gets( Tmp );
cout << A << endl;
} return ;
}