//UVa10082#include<stdio.h>#include<string.h>intmain(){//常量数组chars[] ="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";charc;intlen =strlen(s), i;//当输入不到结尾,就一直获取字符串while(( c =getchar()) != EOF){//通过这个循环找到错位的字符对应的s数组的下标ifor(i =0; i...
UVA10082-WERTYU(紫书例题3.2) 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 consists of several line...
for(i=1;s[i]&&s[i]!=c;i++);这个for循环是在s中查找给定字符c的位置i。s[i]!=c是判断给定字符c是否存在,s[i]是判断字符串s是否结束,相当于s[i]!='\0',当s[i]为字符串结束标志时,s[i]即为false。if(s[i])putchar(s[i-1]);else putchar(c);当s[i]不为字符串结束...
Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1023 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 ...
如何解决UVa10082问题? 题目:键盘错位问题 思路:每输入一个字符,都可以直接输出一个字符,因此用getchar是理想方法。 还有常量数组的使用~~我感jio很妙! 代码语言:javascript 代码运行次数:0 运行 AI代码解释 #include<stdio.h> char s[]="'1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./" int main(){ int ...
UVA - 10082 题意&思路:没有什么思路,又wa了几次,原因是没有加上数字1234.。。。 #include<cstdio> #include<cstring> #include<iostream> #include usingnamespacestd; strings0="`1234567890-="; strings="QWERTYUIOP[]\\"; strings...
char s[]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; int i,c; while((c=getchar())!=EOF) { for(i=1;s[i]&&s[i]!=c;i++); if(s[i]) putchar(s[i-1]); else putchar(c); } return 0; } 这段代码是书上的,为什么定义s的时候A前面要有两个\呢?查看问题描述 关...
//UVa10082 - WERTYU//已AC#include<stdio.h>intmain(){//char s[] = "`qwertyuiop[]asdfghjkl;'\zxcvbnm,./1234567890-=";,这是一个BUGchars[]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";inti,ch;while((ch=getchar())!=EOF){for(i=1;s[i]&&ch!=s[i];i++);//s[i]的目的...
WERTYU UVA - 10082 题目链接 把手放在键盘上时,稍不注意就会往右错一位。这样,输入Q会变成输入W,输入J会变成输 入K等。 输入一个错位后敲出的字符串(所有字母均大写),输出打字员本来想打出的句子。输入保证合法,即一定是错位之后的字符串。例如输入中不会出现大写字母A。 样例输入: O S, GOMR YPFSU/ ...
WERTYU(UVa10082) WERTYU 问题描述 把手放在键盘上时,稍不注意就会往右错一位。这样,输入Q会变成输入W,输入J会变成输入K等。 输入一个错位后敲出的字符串(所有字母均大写),输出打字员本来想打出的句子。输入保证合法,即一定是错位之后的字符串。例如输入中不会出现大写字母A。 样例输入: O S, GOMR YPFSU/...