我希望你是我独家记忆

一段永远封存的记忆,随风而去
posts - 263, comments - 31, trackbacks - 0, articles - 3
   :: 首页 :: 新随笔 ::  :: 聚合  :: 管理

HLOJ_1200( STL中字符串发转用法 )

Posted on 2009-03-13 21:44 Hero 阅读(160) 评论(0)  编辑 收藏 引用 所属分类: 代码如诗--ACM
 1 //1200  Accepted  0 104 362 C++  
 2 
 3 #include <iostream>
 4 #include <string>
 5 #include <algorithm>
 6 using namespace std ;
 7 
 8 string instr ;
 9 char str[10000] ;
10 int innum ;
11 
12 int main()
13 {
14     while( scanf( "%d%*c"&innum ) != EOF )
15     {
16         while( innum -- )
17         {
18             /*
19             gets( str ) ;
20             int len = strlen( str ) ;
21             for( int i=len-1; i>=0; i-- ) 
22                 printf( "%c", str[i] ) ;
23             printf( "\n" ) ;
24             */
25             getline( cin, instr ) ;
26             reverse( instr.begin(), instr.end() ) ;
27             cout << instr << endl ;
28         }
29     }
30 
31     return 0 ;
32 }

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理