| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
加减乘除都不用就把这题AC了!我们11维空间没有加减乘除,但我们有聪明的大脑和一棵热爱物理的心!
import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int a, b, c, d;
a = sc.nextInt();
b = sc.nextInt();
while(b != 0)
{
c = a ^ b;
d = (a & b) << 1;
a = c; b = d;
}
System.out.println(a);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator