ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0

HDU 2573 HDOJ 2573 Typing ACM 2573 IN HDU

Posted on 2010-11-16 17:30 MiYu 阅读(535) 评论(0)  编辑 收藏 引用 所属分类: ACM ( 水题 )

MiYu原创, 转帖请注明 : 转载自 ______________白白の屋    

 

纯模拟, 没什么好说的, 直接代码 

代码
/*
Mail to   : miyubai@gamil.com
My Blog   : www.baiyun.me
Link      : 
http://www.cnblogs.com/MiYu  || http://www.cppblog.com/MiYu
Author By : MiYu
Test      : 1
Complier  : g++ mingw32-3.4.2
Program   : HDU_2573 
Doc Name  : Typing
*/
//#pragma warning( disable:4789 )
#include <iostream>
#include 
<fstream>
#include 
<sstream>
#include 
<algorithm>
#include 
<string>
#include 
<set>
#include 
<map>
#include 
<utility>
#include 
<queue>
#include 
<stack>
#include 
<list>
#include 
<vector>
#include 
<cstdio>
#include 
<cstdlib>
#include 
<cstring>
#include 
<cmath>
#include 
<ctime>
using namespace std;
bool isup = false
int main ()
{
    
int T;
    cin 
>> T;
    
while ( T -- ) {
          
int N;
          
string str, word; 
          cin 
>> N;
          
while ( N -- ) {
               cin 
>> str;
               
if ( str.size() == 1 ) {
                   word 
+= char( isup ? toupper(str[0]) : tolower (str[0]) );     
               } 
else if ( str == "Caps" ) isup = !isup;
               
else {
                    cin 
>> str;
                    word 
+= char!isup ? toupper(str[0]) : tolower (str[0]) );          
               }    
          }   
          cout 
<< word << endl;
          isup 
= false;   
    }
    
return 0;
}

 


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