UVa 10082 - WERTYU
2015-01-31 21:09
288 查看
无语了我哈哈哈哈哈哈哈哈!! 看到这道题就想到了最笨的办法, 明明知道规范解法不是这样,还是闲的没事把所有情况都写了出来,而且这过程中还漏了一种情况,这是个教训啊! 要熟练用常量数组解决问题,简化代码! 多想!
#include <stdio.h>
#include <string.h>
int main()
{
int i,n;
char c;
while( (c=getchar()) != EOF )
{
if(c=='1')
c='`';
else if(c=='2')
c='1';
else if(c=='3')
c='2';
else if(c=='4')
c='3';
else if(c=='5')
c='4';
else if(c=='6')
c='5';
else if(c=='7')
c='6';
else if(c=='8')
c='7';
else if(c=='9')
c='8';
else if(c=='0')
c='9';
else if(c=='-')
c='0';
else if(c=='=')
c='-';
else if(c=='W')
c='Q';
else if(c=='E')
c='W';
else if(c=='R')
c='E';
else if(c=='T')
c='R';
else if(c=='Y')
c='T';
else if(c=='U')
c='Y';
else if(c=='I')
c='U';
else if(c=='O')
c='I';
else if(c=='P')
c='O';
else if(c=='[')
c='P';
else if(c==']')
c='[';
else if(c==' \ ')
c=']';
else if(c=='S')
c='A';
else if(c=='D')
c='S';
else if(c=='F')
c='D';
else if(c=='G')
c='F';
else if(c=='H')
c='G';
else if(c=='J')
c='H';
else if(c=='K')
c='J';
else if(c=='L')
c='K';
else if(c==';')
c='L';
else if(c==39)
c=';';
else if(c=='X')
c='Z';
else if(c=='C')
c='X';
else if(c=='V')
c='C';
else if(c=='B')
c='V';
else if(c=='N')
c='B';
else if(c=='M')
c='N';
else if(c==',')
c='M';
else if(c=='.')
c=',';
else if(c=='/')
c='.';
printf("%c",c);
}
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
int i,n;
char c;
while( (c=getchar()) != EOF )
{
if(c=='1')
c='`';
else if(c=='2')
c='1';
else if(c=='3')
c='2';
else if(c=='4')
c='3';
else if(c=='5')
c='4';
else if(c=='6')
c='5';
else if(c=='7')
c='6';
else if(c=='8')
c='7';
else if(c=='9')
c='8';
else if(c=='0')
c='9';
else if(c=='-')
c='0';
else if(c=='=')
c='-';
else if(c=='W')
c='Q';
else if(c=='E')
c='W';
else if(c=='R')
c='E';
else if(c=='T')
c='R';
else if(c=='Y')
c='T';
else if(c=='U')
c='Y';
else if(c=='I')
c='U';
else if(c=='O')
c='I';
else if(c=='P')
c='O';
else if(c=='[')
c='P';
else if(c==']')
c='[';
else if(c==' \ ')
c=']';
else if(c=='S')
c='A';
else if(c=='D')
c='S';
else if(c=='F')
c='D';
else if(c=='G')
c='F';
else if(c=='H')
c='G';
else if(c=='J')
c='H';
else if(c=='K')
c='J';
else if(c=='L')
c='K';
else if(c==';')
c='L';
else if(c==39)
c=';';
else if(c=='X')
c='Z';
else if(c=='C')
c='X';
else if(c=='V')
c='C';
else if(c=='B')
c='V';
else if(c=='N')
c='B';
else if(c=='M')
c='N';
else if(c==',')
c='M';
else if(c=='.')
c=',';
else if(c=='/')
c='.';
printf("%c",c);
}
return 0;
}
相关文章推荐
- 经典第三章 例题 3-2 UVA 10082 WERTYU(字符处理)
- UVA 10082 WERTYU
- UVA-10082 WERTYU
- UVa 10082 - WERTYU
- Problem 002——UVa 10082 - WERTYU
- uva 10082 WERTYU(错位键)
- UVA 10082(p47)----WERTYU
- UVA 10082 WERTYU
- WERTYU - UVA - 10082
- UVa 10082 WERTYU
- uva-10082 - WERTYU
- UVa10082_WERTYU
- POJ2538 ZOJ1884 UVA10082 WERTYU【输入输出+水题】
- UVA 10082 WERTYU
- UVA 10082 WERTYU
- Uva 10082 WERTYU
- UVa 10082 - WERTYU
- UVa-10082 WERTYU
- UVA 10082 - WERTYU
- UVa-10082 WERTYU