HDU 2700 Parity(水~)
来源:互联网 发布:vb编程基础教程下载 编辑:程序博客网 时间:2024/05/21 06:30
Description
给你一个01数字串,最后一个字母为e或者o,你需要将e或o换成0或1,e使得整个串1的个数为偶数,o使得整个串1的个数为奇数
Input
多组输入,每组用例占一行,以#结束输入
Output
对于输入的每个字符串,输出将e/o转换成0/1后的串
Sample Input
101e
010010o
1e
000e
110100101o
#
Sample Output
1010
0100101
11
0000
1101001010
Solution
水题~
Code
#include<stdio.h>#include<string.h>int main(){ char c[33]; while(scanf("%s",c),c[0]!='#') { int len=strlen(c),res=0; for(int i=0;i<len-1;i++) if(c[i]=='1') res++; if(c[len-1]=='e') c[len-1]=res%2?'1':'0'; else c[len-1]=res%2?'0':'1'; printf("%s\n",c); } return 0;}
0 0
- HDU 2700 Parity(水~)
- HDU 2700 Parity (水题)
- HDU 2700 Parity(模拟)
- HDU 2700 Parity(签到)
- hdu 2700 Parity
- HDU 2700 Parity
- HDU 2700 Parity
- HDU 2700 【Implementation】Parity
- HDU-2700-Parity
- Parity HDU 2700
- HDU 2700 Parity
- hdu 2700 Parity
- hdu 2700 Parity
- hdu 2700 parity
- HDU 2700 Parity
- hdu-2700-Parity
- HDU 2700 Parity [Ad Hoc]
- HDU 2700 Parity【字符处理】
- 编写一个函数print,打印一个学生的成绩数组
- HDU 2561 第二小整数(水~)
- ocp-79
- ocp-80
- 使用mvc3制作物流单号查询页面
- HDU 2700 Parity(水~)
- Scala实现WordCount功能
- 1079. Total Sales of Supply Chain (25) - 1106. Lowest Price in Supply Chain (25) 类树操作
- ThinkPHP的CURD
- 且看本菜鸟如何装系统
- 小问题解决与体会
- sae新浪云开发所需要资源下载
- 半年总结
- 关于管理经济学的有趣解释