fork download
  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.*;
  4.  
  5. class Ideone {
  6. public static int gcd(int a, int b){
  7. while(b != 0) b ^= a ^= b ^= a %= b;
  8. return a;
  9. }
  10. public static void main(String args[]) {
  11. Scanner in = new Scanner(System.in);
  12. int a = in.nextInt(); int b = in.nextInt();
  13. int c = (a + b)/gcd(a, b);
  14. System.out.println((a == b || c == (c & (-c))) ? 1 : 0);
  15. }
  16. }
Success #stdin #stdout 0.14s 321280KB
stdin
10 20
stdout
1