diff --git a/bin/ChatClient$IncomingReader.class b/bin/ChatClient$IncomingReader.class index 5346d48..2ac4000 100644 Binary files a/bin/ChatClient$IncomingReader.class and b/bin/ChatClient$IncomingReader.class differ diff --git a/bin/ChatClient$SendButtonListener.class b/bin/ChatClient$SendButtonListener.class index 0a838c4..f52f8b1 100644 Binary files a/bin/ChatClient$SendButtonListener.class and b/bin/ChatClient$SendButtonListener.class differ diff --git a/bin/ChatClient.class b/bin/ChatClient.class index fffaff2..09c4399 100644 Binary files a/bin/ChatClient.class and b/bin/ChatClient.class differ diff --git a/bin/ChatServer$ClientHandler.class b/bin/ChatServer$ClientHandler.class index b43eb77..9ebb56e 100644 Binary files a/bin/ChatServer$ClientHandler.class and b/bin/ChatServer$ClientHandler.class differ diff --git a/bin/ChatServer$SendButtonListener.class b/bin/ChatServer$SendButtonListener.class index b09722f..8756faa 100644 Binary files a/bin/ChatServer$SendButtonListener.class and b/bin/ChatServer$SendButtonListener.class differ diff --git a/bin/ChatServer.class b/bin/ChatServer.class index 8d35046..392779a 100644 Binary files a/bin/ChatServer.class and b/bin/ChatServer.class differ diff --git a/bin/Constants.class b/bin/Constants.class new file mode 100644 index 0000000..2286243 Binary files /dev/null and b/bin/Constants.class differ diff --git a/bin/Main.class b/bin/Main.class new file mode 100644 index 0000000..423e120 Binary files /dev/null and b/bin/Main.class differ diff --git a/src/I.java b/src/I.java index 2a9ef94..4574fb1 100755 --- a/src/I.java +++ b/src/I.java @@ -2,11 +2,11 @@ import java.util.Scanner; class Main { - public static void main(String[] args) throws java.lang.Exception { - // your code goes here - Scanner scan = new Scanner(System.in); - int t = scan.nextInt(); + // Reading input from user + Scanner scan = new Scanner(System.in); + int t = scan.nextInt(); + for (int cs = 1; cs <= t; ++cs) { String a = scan.next(); String b = scan.next(); @@ -17,12 +17,12 @@ public static void main(String[] args) throws java.lang.Exception { String an = ans.toString(); long gt = gv(an); - while (gt >= 10) { - gt = sod(gt); - } + while (gt >= 10) gt = sod(gt); + System.out.println("Case " + cs + ": " + gt); } + scan.close(); } public static long sod(long x) { @@ -54,82 +54,4 @@ public static BigInteger pow(BigInteger base, BigInteger exponent) { return result; } - -// CLASS: Main -class Main -{ - // FUNCTION: main - public static void main (String[] args) throws java.lang.Exception - { - // your code goes here - Scanner scan = new Scanner(System.in); - int t = scan.nextInt(); - - for(int cs = 1; cs <= t; ++cs) - { - String a = scan.next(); - String b = scan.next(); - - System.out.println(a + " " + b); - - BigInteger bg = new BigInteger(a); - BigInteger gg = new BigInteger(b); - BigInteger ans = pow(bg, gg); - //System.out.println(ans.toString()); - - String an = ans.toString(); - long gt = gv(an); - - while(gt >= 10) - { - gt = sod(gt); - } - System.out.println("Case " + cs + ": " + gt); - } - - } - - // FUNCTION: sod - public static long sod(long x) - { - long anss = 0; - - while(x != 0) - { - anss += x % 10; - x /= 10; - } - - return anss; - } - - // FUNCTION: gv - public static long gv(String x) - { - long xx = 0; - - for(int i = 0; i < x.length(); ++i) - { - xx += x.charAt(i) - '0'; - } - - return xx; - } - - // FUNCTION: pow - public static BigInteger pow(BigInteger base, BigInteger exponent) - { - BigInteger result = BigInteger.ONE; - - while (exponent.signum() > 0) - { - if (exponent.testBit(0)) result = result.multiply(base); - - base = base.multiply(base); - exponent = exponent.shiftRight(1); - } - return result; - } - - -} \ No newline at end of file +}