poj 2538 WERTYU
2014-11-27 18:41
225 查看
WERTYU
Description
A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.
Input
Input consists of several lines of text. Each line may contain digits, spaces, upper case letters (except Q, A, Z), or punctuation shown above [except back-quote (`)]. Keys labelled with words [Tab, BackSp, Control, etc.] are not represented in the input.
Output
You are to replace each letter or punctuation symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.
Sample Input
Sample Output
水题。。。
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 8492 | Accepted: 4063 |
A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.
Input
Input consists of several lines of text. Each line may contain digits, spaces, upper case letters (except Q, A, Z), or punctuation shown above [except back-quote (`)]. Keys labelled with words [Tab, BackSp, Control, etc.] are not represented in the input.
Output
You are to replace each letter or punctuation symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.
Sample Input
O S, GOMR YPFSU/
Sample Output
I AM FINE TODAY.
水题。。。
#include <iostream> #include <string.h> using namespace std; int main(){ char ss[10000],s; while (gets(ss)){ int len=strlen(ss),i=0; while (i<len){ s=ss[i++]; if (s=='W') cout<<'Q'; else if (s=='E') cout<<'W'; else if (s=='R') cout<<'E'; else if (s=='T') cout<<'R'; else if (s=='Y') cout<<'T'; else if (s=='U') cout<<'Y'; else if (s=='I') cout<<'U'; else if (s=='O') cout<<'I'; else if (s=='P') cout<<'O'; else if (s=='[') cout<<'P'; else if (s==']') cout<<'['; else if (s=='\\') cout<<']'; else if (s=='S') cout<<'A'; else if (s=='D') cout<<'S'; else if (s=='F') cout<<'D'; else if (s=='G') cout<<'F'; else if (s=='H') cout<<'G'; else if (s=='J') cout<<'H'; else if (s=='K') cout<<'J'; else if (s=='L') cout<<'K'; else if (s==';') cout<<'L'; else if(s=='\'') cout<<';'; else if (s=='X') cout<<'Z'; else if (s=='C') cout<<'X'; else if (s=='V') cout<<'C'; else if (s=='B') cout<<'V'; else if (s=='N') cout<<'B'; else if (s=='M') cout<<'N'; else if (s==',') cout<<'M'; else if (s=='.') cout<<','; else if (s=='/') cout<<'.'; else if (s=='2') cout<<'1'; else if (s=='3') cout<<'2'; else if (s=='4') cout<<'3'; else if (s=='5') cout<<'4'; else if (s=='6') cout<<'5'; else if (s=='7') cout<<'6'; else if (s=='8') cout<<'7'; else if (s=='9') cout<<'8'; else if (s=='0') cout<<'9'; else if (s=='-') cout<<'0'; else if (s=='=') cout<<'-'; else cout<<s; } cout<<endl; //cin.getline(ss,10000); } return 0; }
相关文章推荐
- poj 2538 WERTYU
- POJ 2538 WERTYU(我的水题之路——键盘错位)
- POJ 2538 WERTYU 模拟
- POJ 2538 WERTYU水的问题
- zoj 1884 || poj 2538 WERTYU(这水让我很YM!)
- POJ 2538 WERTYU(水~)
- poj 2538 WERTYU
- POJ 2538 WERTYU(水题)
- poj 2538 WERTYU
- poj 2538 WERTYU
- POJ 2538 WERTYU(打错字符——制表)
- pku 2538 WERTYU
- POJ 2538
- poj 2538(简单题)
- POJ-2538
- poj-2538
- POJ_2538
- 算典03_例题_02_Poj-2538
- POJ 之 WERTYU
- POJ 2538 WERTYU G++