UVa 10469 To Carry or not to Carry (异或)
来源:互联网 发布:二级c语言考试时间 编辑:程序博客网 时间:2024/05/14 07:14
10469 - To Carry or not to Carry
Time limit: 3.000 seconds
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1410
6+9=15 seems okay. But how come 4+6=2?
You see, Mofiz had worked hard throughout his digital logic course, but when he was asked to implement a 32 bit adder for the laboratory exam, he did some mistake in the design part. After tracing the design for half an hour, he found his flaw!! He was doing bitwise addition but his carry bit always had zero output. Thus,4 = 00000000 00000000 00000000 00000100+6 = 00000000 00000000 00000000 00000110---------------------------------------- 2 = 00000000 00000000 00000000 00000010Its a good thing that he finally found his mistake, but it was too late. Considering his effort throughout the course, the instructor gave him one more chance. Mofiz has to write an efficient program that would take2 unsigned 32 bit decimal numbers as input, and produce an unsigned 32 bit decimal number as the output adding in the same was as his circuit does.
Input
In each line of input there will be a pair of integer separated by a single space. Input ends at EOF.Output
For each line of input, output one line -- the value after adding the two numbers in the "Mofiz way".Sample Input
4 66 9
Sample Output
215
0+0=0
0+1=1
1+0=1
1+1=0
这不异或么。。
完整代码:
/*0.015s*/#include<cstdio>int main(){int a, b;while (~scanf("%d%d", &a, &b))printf("%d\n", a ^ b);return 0;}
- UVa 10469 To Carry or not to Carry (异或)
- UVa 10469 - To Carry or not to Carry
- Not possible to carry out conversion
- When it’s time to quit, that’s the time to carry on.
- Why not just carry on extending HTML?
- Carry Leetcode
- uva 10273 Eat or Not to Eat?
- UVA - 10273 Eat or Not to Eat?
- UVA 10273 Eat or Not to Eat?
- UVA - 1541 To Bet or Not To Bet (DP+概率)
- To xor or not to xor 高斯消元求异或
- sgu275:To xor or not to xor(最大异或和)
- 异或思维题--to xor or not to xor nkoj3734
- Overflow flag & Carry flag
- carry on till tomorrow
- 2243: Endless Carry
- Ripple-Carry Adder
- Carry Look-ahead Adder
- JAVA进行Excel读写
- 大话CASSANDRA数据模型
- 当request中的list为空时,在页面显示 没有记录
- 基于STM32的SDIO用4位总线24MHZDMA模式操作SHDC卡
- 使用eagle导出国内PCB制板商可用的gerber文件 | APLUSA +复制链接
- UVa 10469 To Carry or not to Carry (异或)
- 原生态日历控件
- asp.net ajax回调函数
- s标签传值时候,,值太长的话,传递值就会失败
- Mac下配置Eclipse内存,解决Eclipse内存溢出问题
- 加密brief
- Java内功基础(一)对象导论
- 做有良心的开发者
- poj 1308 - Is It A Tree?(并查集)