现在的位置: 首页 > 综合 > 正文

zoj 1151

2013年12月23日 ⁄ 综合 ⁄ 共 588字 ⁄ 字号 评论关闭

//1151

//´ËÌâºÍ1051Ïàͬ£¬presentation wrong µÄÔ­ÒòÊÇ×îºóÒ»¸öblock¶àÁËÒ»¸ö¿ÕÐС£ÁíÍâÒ²ÌåÏÖ³övc6.0µÄbug£¬getlineµÄÎÊÌâ¡£

#include <iostream>

#include <string>

using namespace std;

 

string turn(string str)

{

string temp = "";

for( int i = str.length()-1; i>=0; i--)

temp+=str.at(i);

return temp;

}

int main()

{

int n;

cin>>n;

while(n--)

{

int sn;

cin>>sn;

getchar();

while(sn--)

{

string str;

getline(cin,str);

string ts = "";

while(str.find_first_of(' ')!=-1)

{

string temp = turn(str.substr(0,str.find_first_of(' ')));

ts += (temp+" ");

str = str.substr(str.find_first_of(' ')+1,str.length());

}

ts = ts + turn(str);

cout<<ts<<endl;

}

if(n!=0)

cout<<endl;

}

return 0;

}

抱歉!评论已关闭.