HDU 2573 模拟
来源:互联网 发布:人工智能黑科技 编辑:程序博客网 时间:2024/05/22 12:54
Typing
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 997 Accepted Submission(s): 628
Problem Description
A boy named Pirates who wants to develop typing software finds that it’s hard to judge whether a letter is lowercase or uppercase. He searches lots of information about it, and find out the solution, but he doesn’t know how to realize it. Can you help him?
The Solution:
1: If the caps lock is on, and the letter is typed with shift key down, the letter is lowercase, otherwise it’s uppercase.
2: If the caps lock is off, and the letter is typed with shift key down, the letter is uppercase, otherwise it’s lowercases.
The Solution:
1: If the caps lock is on, and the letter is typed with shift key down, the letter is lowercase, otherwise it’s uppercase.
2: If the caps lock is off, and the letter is typed with shift key down, the letter is uppercase, otherwise it’s lowercases.
Input
The first line is an integer t, which is the number of test case in the input data file. Each test case begins with an integer n (0<n<=100), which means there follow n lines. For each line, if there is only a letter, it means the key is typed, and if there begins with a string “Shift”, then will follows one letter, it means the letter is typed with shift key, and if there begins with a string “Caps”, it means the caps lock key is typed and changes the mood of caps lock. The entire letter is lowercase. At the beginning of each test case, you can assume that the caps lock is off.
Output
Please output a string which the user typed.
Sample Input
25CapsacShift iShift t6CapsacCapsit
Sample Output
ACitACit#include<cstdio>#include<iostream>#include<cstring>using namespace std;int main(){int T=0;scanf("%d",&T);while(T--){char na[105];char op[100];bool mark=0;int t=0;int n=0;scanf("%d",&n);getchar();for(int i=0;i<n;i++){gets(op);if(strcmp(op,"Caps")==0){mark=!mark;}else{if(mark){ if(strlen(op)>1) { na[t++]=op[6]; } else { na[t++]=op[0]-32; }}else{ if(strlen(op)>1) { na[t++]=op[6]-32; } else { na[t++]=op[0]; }}}}na[t]='\0';printf("%s\n",na);}return 0;}
0 0
- HDU 2573 模拟
- 【几何模拟】hdu 3286
- hdu 1020 Encoding(模拟)
- hdu 1303 Doubles(模拟)
- hdu 4020 模拟
- HDU **** 暴力模拟
- HDU 4068 模拟
- HDU 4121 模拟
- 【模拟】HDU 4134
- HDU-1279 模拟
- HDU-1035 模拟
- HDU-1283 简单模拟
- HDU-1263 模拟
- hdu 4140 模拟
- hdu 1034 #模拟
- hdu 4194#模拟
- hdu 4350 Card 模拟
- hdu 4393 贪心+模拟
- UDP协议
- 方法
- 主窗体跳转内部窗体
- java web编码的学习总结
- 生活、工作、总结(九)
- HDU 2573 模拟
- 【iOS学习笔记 15-09-27】iOS中的MVC设计模式
- 黑马程序员-----C语言学习带参宏和函数的区别
- Decode Ways
- HDU 5492 Find a path DP —— 2015 ACM-ICPC Asia Regional Hefei Online
- 计算器的代码
- iOS之UI随笔-UIScrollView
- qcow2、raw、vmdk等镜像格式的比较和基本转换
- hdu5479 最小代价的统计