http://poj.org/problem?id=1348 Computing Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 1681 Accepted: 248 Description Input any five positive integral numbers n1, n2, n3, n4, n5, such that 0<=ni<=100, 1<=i<=5. To the first fou
//不用加减乘除四则运算,来做加法 //题目:两个数做加法. //思路:用二进制的位运算的思路.第一步:首先两数相加考虑进位.可以用异或. //第二步:两个数相加只考虑进位,并将最后的结果左移.第三步:将第一二步的结果相加. public class AddN { public int add(int a,int b){ //递归实现 int sum1=a^b; ; ){ return add(sum1,sum2); } /*循环实现 * int sum1,sum2; do{ sum1=a^b;