fork download
  1. import java.util.*;
  2. import java.math.BigInteger;
  3. class TWONMS
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner s = new Scanner(System.in);
  8. int n = s.nextInt();
  9. for(int i=0;i<n;i++)
  10. {
  11. BigInteger A = s.nextBigInteger();
  12. BigInteger B = s.nextBigInteger();
  13. long N = s.nextLong();
  14. for(long h=1;h<=N;h++)
  15. {
  16. if(h%2==1) A = A.multiply(BigInteger.valueOf(2));
  17. else B=B.multiply(BigInteger.valueOf(2));
  18. }
  19. BigInteger dividend = A.max(B);
  20. BigInteger divisor = A.min(B);
  21. System.out.println(dividend.divide(divisor));
  22. }
  23. }
  24. }
Success #stdin #stdout 0.06s 4386816KB
stdin
3
1 2 1
3 2 3
3 7 2
stdout
1
3
2