UVa 10469 to Carry or not to Carry: XOR or

Source: Internet
Author: User
Tags time limit

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'll be Mofiz had worked hard throughout his digital logic, course as he is but to asked a-bit implement for The laboratory exam, he did some mistake After tracing the "design" for half a hour, he found his flaw!! He is 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 00000010

This article URL address: http://www.bianceng.cn/Programming/sjjg/201410/45356.htm

Its a good thing so he and finally found his mistake, but it is too late. Considering his effort throughout the course, the instructor gave one more him. Mofiz has to write a efficient program that would take2 unsigned-bit decimal numbers as input, and produce an unsigned The bit decimal number as the output adding in the same is as his circuit does.

Input

In the each line of input there would be a pair of the integer separated by a. 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 6
6 9

Sample Output

2
15

0+0=0

0+1=1

1+0=1

1+1=0

It's the same or not.

Complete code:

/*0.015s*/
    
#include <cstdio>  
    
int main ()  
{  
    int a, b;  
    while (~SCANF ("%d%d", &a, &b))  
        printf ("%d\n", a ^ b);  
    return 0;  
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.