標題:
2010網際網路全國程式設計大賽(A. 迴文)
[打印本頁]
作者:
buy
時間:
2010-12-11 11:11
標題:
2010網際網路全國程式設計大賽(A. 迴文)
本帖最後由 buy 於 2010-12-11 11:14 編輯
把正確答案貼上來吧各位童鞋
作者:
Alen
時間:
2010-12-11 11:13
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main(void){
int HowManyTimes;
cin >> HowManyTimes;
string s = "";
bool IsElse = false;
for (int i = 0;i < HowManyTimes;i++){
cin >> s;
for (int j = 0;j < s.length();j++){
if (s[j] == s[s.length() - 1 - j]){
}else{
IsElse = true;
break;
}
}
if (IsElse == true){
cout << "no" << endl;
}else{
cout << "yes" << endl;
}
}
system("Pause");
return 0;
}
複製代碼
作者:
chuangjoy
時間:
2010-12-11 11:36
#include<iostream>
#include<cstdlib>
using namespace std;
int main(void){
int HowManyTime;
cin >> HowManyTime;
string s = "";
bool IsElse = false;
for(int a=0; a<HowManyTime; a++){
cin >> s;
for(int b=0; b<s.length(); b++){
if(s[b] == s[s.length()-b-1]){
}else{
IsElse = true;
break;
}
}
if(IsElse == true){
cout << "no" << endl;
}else{
cout << "yes" << endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
p17johnny
時間:
2010-12-11 11:38
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main(){
int HowManyTimes;
cin>>HowManyTimes;
string s="";
bool IsElse = false;
for(int a=0; a<HowManyTimes;a++){
cin>> s;
for(int b=0; b<s.length();b++){
if(s[b] == s[s.length()-b-1]){
}else{
IsElse = true;
break;
}
}
if (IsElse == true){
cout<<"no"<<endl;
}else{
cout<<"yes"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2