本站遷移

因為我最近租用了網路空間以及網域,
故本站已遷移至新網站~
這邊的資訊已經正在進行搬移的工作~
希望各位可以到新網站去逛XD

New Website:
http://knightzone.org/

搜尋此網誌

2011年2月26日 星期六

[Zerojudge]a022: 迴文

利用字串處理,並且利用for來反轉字串,很快速即可過關。

[C++](0ms, 730KB)
#include<iostream>
using namespace std;
int main()
{
string str;
while( getline( cin, str ) )
{
string rev;
for( int i = str.length()-1 ; i >= 0 ; i-- )
rev += str[i];
if( rev == str )
cout << "yes\n";
else
cout << "no\n";
}
return 0;
}

0 意見:

張貼留言