LightOj 1214 - Large Division

        // Verdict : Accepted

  1. import java.util.*;
  2. import java.math.*;
  3. class Main
  4. {
  5.     public static void main (String[] args)
  6.     {
  7.         Scanner in = new Scanner(System.in);
  8.         long tc,t;
  9.         tc=in.nextInt();
  10.         for (t=1;t<=tc;t++)
  11.         {
  12.             BigInteger a=in.nextBigInteger(),b=in.nextBigInteger(),m;
  13.             a=a.abs();b=b.abs();
  14.             m=a.mod(b);
  15.             if(m.equals(BigInteger.valueOf(0)))
  16.             {
  17.                 System.out.println("Case "+t+": "+"divisible");
  18.             }
  19.             else
  20.             {
  21.                 System.out.println("Case "+t+": "+"not divisible");
  22.             }
  23.         }
  24.     }
  25. }

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number