/*有一个特殊的 5键键盘,上面有 a,ctrl-c,ctrl-x,ctrl-v,ctrl-a五个键。输入描述:输入为一行,为简化解析,用数字 12345代表 a,ctrl-c,ctrl-x,ctrl-v,ctrl-a五个键的输入,数字用空格分隔输出描述:输出一个数字,为最终屏目上字母的数量。示例:输入111输出3*/#include int main(){int a;int flag_c = 0, flag_a = 0, c_num = 0;int sum = 0;while(scanf("%d", &a) !=EOF) {if (a == 1) { /* input a */if (flag_a == 1) {flag_a = 0;sum = 1;} else {sum++;}} else if (a == 2) { /* ctrl + C */if (flag_a == 1) {flag_c = 1;c_num = sum;}} else if (a == 3) { /* ctrl + X */if (flag_a == 1) {flag_a = 0;flag_c = 1;sum = 0;c_num = sum;}} else if (a == 4) { /* ctrl + V */if (flag_c == 1) {if (flag_a == 1) {flag_a = 0;sum = c_num;} else {sum += c_num;}}} else if (a == 5) { /* ctrl + A */flag_a = 1;} else {printf("invalid input %d \n", a);}} printf("%d", sum); return 0;}