From 671035d6c0ece75204b0700b41670518250186bd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Oct 2018 21:02:05 -0300 Subject: [PATCH] cleaned code at I.java --- bin/ChatClient$IncomingReader.class | Bin 1720 -> 1696 bytes bin/ChatClient$SendButtonListener.class | Bin 1420 -> 1424 bytes bin/ChatClient.class | Bin 3835 -> 3839 bytes bin/ChatServer$ClientHandler.class | Bin 2372 -> 2430 bytes bin/ChatServer$SendButtonListener.class | Bin 1188 -> 1188 bytes bin/ChatServer.class | Bin 4745 -> 4752 bytes bin/Constants.class | Bin 0 -> 718 bytes bin/Main.class | Bin 0 -> 2470 bytes src/I.java | 94 ++---------------------- 9 files changed, 8 insertions(+), 86 deletions(-) create mode 100644 bin/Constants.class create mode 100644 bin/Main.class diff --git a/bin/ChatClient$IncomingReader.class b/bin/ChatClient$IncomingReader.class index 5346d48f181c330587ca5a3602985cbc2922e416..2ac4000a975538ed75b76ea6d6cbbc3087dc06c8 100644 GIT binary patch delta 185 zcmdnNyMT8?95ZWXzP_jb zftz7Eg9gJ425p9!4CV~87;G5kFeC!$0*0v!^$d#`ni&=|v@Pswh zt=Dp;2@5)yf-`J>c$B3C3(4UAe~AcDak5E^3W{gZ8kLZ`Ez+PvS2!qDK=D8ibpahg BDail; diff --git a/bin/ChatClient$SendButtonListener.class b/bin/ChatClient$SendButtonListener.class index 0a838c45244ab84025319ebfc47f3409e4dea8c3..f52f8b129c1f2eedf12a456f0a7afbb78a53ad8c 100644 GIT binary patch delta 59 zcmeC-p1{4KmxZx%avzI4H37}yyY7-AR<7-AW$7~&c17!nwq7?K(M7*ZG_ L7*Z!Yv-$!6eDDk_ diff --git a/bin/ChatClient.class b/bin/ChatClient.class index fffaff247076f8f52131705e1d40031eeaa53bbd..09c4399c2b3789663358e1c65775d3803be98e03 100644 GIT binary patch delta 707 zcmX|;Jxo(!6o#LV+ur_g!3M1a1F?xhp&A>02Xw!@fL63$V)zbPj`WcYKyitgyGDae&uL^99b4@drJftyf$sQ?NQoL|4Z6va} zMN1sfxN_V(vY0C9$+Y2MR8aljw)v~fb1}l0<>0Cm8e^6e)Yl8a;q1z4He+N8A!}5G zag7Nk%_gP68DUD}x_l&*bLtHZ7pnPKsTY&Gdx}@_%C9)2pLpuN;ijG~jc2mJ`&>-<9wE#-BjUAw1j^Ugm_4c@f~22&ycIHg21*EBw{9qJ|f| zM8PjAc_lNO9R9`pQPC_um}e@N{0;IHa0d^|oF&Z#R;014G;xBwj zjd9_FxKV?YMNM40bLUbwMiV#2xO0K$BDk7!=0EeDnfdqY{?xq=lnBqGVb6w(ARQ`| zbPBBgSgdu{iJ(ixip|t|RC?(Xl;-q&Je|=~tJ;dd;=k59Ysv#E=S|ryWmB5Y-(AvE z+0_M898wuRs*NtB^Ve(!R`Ma4fFP>q`#8@|T33%V~?ccQm{1 zVuXO5i^k8AlWkEhn@z?9)&96y9n{wH!EknYC7aPR`2n+=DB~(|5=O7m?1(a{az$Ql zDh-|~6(=?aGXm$;oWAOfr*nDZfzl)rJG+WU@yOxra)RmfJ>5kUTPlxb>1SJ`=-aW_ zuUmw}m@kbuD{29ng$T z^~pvpE>2KE9j7@(EA_PFrBB|%_~cF+NYTg*npviW+xWRJUu_cLA!pd4ji;RDjWqBb z=lDP;9|`e^F22ysH+uLXX}=j@pF!bfNO%|#UPeVgdKk135g}>Y%d(d0Fu!=t3lxcd w#l@{xq1?^fe8kglx8N0F(orI#&&t?FX8x?Bme*a diff --git a/bin/ChatServer$ClientHandler.class b/bin/ChatServer$ClientHandler.class index b43eb776e65953347dbe2a176dc4ce6504734939..9ebb56e60326991d76d257d49f9cf78424b35a80 100644 GIT binary patch delta 335 zcmXAjT`PlO7{`D2^X%C@kCIj+vI9{pv!w_rqA-j}aUushptci^_yA_i>$vj?)^hw`~UhF^n&h_cXtmAVoL6dax&ZTxs-WRx6Nu(5lUv$ zyXkoSvwUO4?0`#-sOG@DsuuI?Buvo?+nR#u@ISP5(?AbR^b#f_(?>s128fkE{p%{b zUqa!d%Db4@#3Xi&P(9pYNRUx9V>B{OI}>y=Nt`LsPqV~~aA(;NPKJ5*SRhZ5GZv`` zS|uf}%hXumn^jW@wC?0Nl)NqB{BIUt98tiMqz{fckq$K+PKDuPSbB8fcxX*RbFLyk e(%+}W;_pHv*P5JP~o+9tCIb{96mUdk)z}99C55z6+DIL)23gtC|(t7Nn1`#?3+#k bRu;b#l3ZH+pya2bI-GH?9ujW!hXUpYdpkZM diff --git a/bin/ChatServer$SendButtonListener.class b/bin/ChatServer$SendButtonListener.class index b09722fa89d294b082bf7eb7bb289ceb96035ad3..8756faa8bd69c6587bb79e4d5f1e11f5e6b10d2c 100644 GIT binary patch delta 35 rcmZ3&xrB4WF=ocd$;X+e2_`UTFeEZ~FeEdCFr+ZVF{Dn;V=)5&zxxS% delta 35 rcmZ3&xrB4WF=obq$;X+e35GIgFoZF9FhnqfFhnxMF+@+!V=)5&yg~^* diff --git a/bin/ChatServer.class b/bin/ChatServer.class index 8d350467c9d3f330120a28db69fcf69d19307e84..392779af3d7bf7595f157088d7a6e68adde7d018 100644 GIT binary patch delta 379 zcmWNLNhpK?6vuyGm^5bkP%{U+sUd_=KwZ=e5B3|^Y1#l^Y)lv$(Mf+s86Dq+87XTjCR+# z*{Z~L;X^N05d+bQWDt!ZQW++l5pwAxpK%J9ppZ%3qLwLJx>L=FiN+`((|9u@33FJO z7t{qpSR@=5HkOGHFP>G`ms+W`uFJuO&~J*pMHJg4utPGtq_KyCeX==_XNMGXL>0%> zb3zBF!hFUk7ff*}p;xTomg{TTx)J4;NACFGo=+b5mg$#g!UQf6FR6d>&j$LFU!M6z Pa9=U;hA;2B!$0L8deLD` delta 372 zcmWNLNhpK?7>1uejBTbLWoTqAGbzijIJh_{Bsp+#GTBLEcc3Pd$z%zc{vul`J6Xrh zAO{pjTpi`&qLiY1ef9PBetqxzOs0;c?tLr422Im4Gt+&)%66DZB@iqOKk7o2g+Igg^Ax#SH$A6)UtHDBEDE7v3e%OObipY)}G{vK&J-3jVFMjnXZ JNw0{?{|D@7S?B-& diff --git a/bin/Constants.class b/bin/Constants.class new file mode 100644 index 0000000000000000000000000000000000000000..22862437609774f83d957866bfe70f21b90770b8 GIT binary patch literal 718 zcmYk3*>2N76o&uF(zt25QkIs@DO+1gk|HE7K%mqNX@p}(v6~bL$(kgi)Rk*Xwgcp` zxI*HB2jHO)XQH-PmX7B;XU_J|pTEC;19*i-2|0#EBMOsLglSSjfnn`jd=>RTgp;~G zJeQ-CVZkul+;SN<%>O|rjs0-)hGF?Czb}HR)Uc=$0$+xdS#Y@ZK|@8IWH@G6>Tt(t zwzzj>pK4fD4w)okBK4!_JI!+9@SbP39aqDK!bHZp=_gcbb-+!-?r`t2f`*$6I|CVv zq6?{4^-q2{4rY2HX8O0YNS{ShUBps+|F>o_g1-!whLw$xw41BPOw(WupE`yOw3{M6%);dPs?%X^lFDnste0bSyquKQWT zV+N1_Z~f3u-!bHO_xjY!h{m#vJoYMhf~T~M>4(yqUJPaIieVs?w9!ZeeG&VLFP(+- z%uh%o^Gf1`^e#KmG#<&1zDirUj?~oCpi0eYA(XL&A{K~BL^){0=9(Y;LkKJmj0>%==5engo}X+icGO<12ZP~88C-5>Lj_sOaS Vl%CJYR_5m-4)9{`tC7v2{ts|8d-?zX literal 0 HcmV?d00001 diff --git a/bin/Main.class b/bin/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..423e1206cd3d8e67677babda46f95711a554f777 GIT binary patch literal 2470 zcmaJ@ZF3V<6n<{9$tLMmO8No;+6L5;rnCWzplyM^0NT(}q*4V`+@?#iCE0{zQ;MRX zg70r=#nF)&b)2amWJdXrR+;e!_%rQj0wty{_1$oQm@um!w5re)fD1>BL=F~$yLCyW5x@N4kE zE3jtBw2Z^W%(#(%Rv%9r0>PndLQjwBc~d@DUMhCVEHK-U#Oh|A4DSLBk&{D9n4@;y zw36KtCvadoVdQKxYZX)k1!|X~?s`$K>KPd?km2+o>E8AqhXKK%4cWG2m$OvpNihaj^w7{RnW;G`QJOQm zpZYrLWOO?f>o=3^gprie44^Xrfu}S)jX{c>%bpY1Um>_6y1UGA<=curD__gpJu>%@ zhG87$I3=eZpjKRl9ntU%j*>zlOO2FByfyCO?vtN@51e(+fL<^hMW2_79v9dY8N9za zi@N!6l9*l2f*0k2m*j%@gBQr5d|87ox2q?S&K9^y6+NHieym+(`_Wn8PNK6c%ksU& zohvx3f{MBlTrYIF-&fA3j2dUec#=DOb#0|;^tyG6SzHp$m6VC&0@b6oo;WkC=bWQM zMS`!VC1a~lkRv~>;XGd9*dzp41G0mcHC(~loF&^R*!^ZD%?asxSHpXFpF^1`rfoBqJ}=PmfWi5n5&2NVNBEd0 zSs`VfwvU?06fr_~8@t+6eX8NA!@poAts==Pbp2l$B}3uZ-3B=Eg159>0nDIcywiE1_wRvUe6&X>I9JoU7+1T5chFJfzHH+Z-MX zK3>A^kcXENx=Yx53j_4c;Xs$yF+I{$L*9@&kAq#lkgtSzmp|m6$D!SUSp*sa^BCF9 zTOCGczFGLEl0JBhxf@G(E_i~e8v-S~P|knZEgCodu#h8}Q?gvQQ*OUgj>>Xs*(lY(ZQ@ik6%CufW74h1-maI77=roMT8cyO(HjShQ4P_908l#|&M_G0xAYPMk%a z=mp~RK)Hi@6}3Vv-~_5v*v^BBcIP{wqWo=F*x3cNL0JspYQH>#$Wcy1j>wF`Mt|Qd z)`puX>RG){-ZJ}|{4-xK{2jhQcUiOz3K;Q>rkJlP1cs#gU-!1&ryhNda zz(5O=ZYBQ+;kS}N)PWB>^ByMrqyyiC*9p&^!(LrCwh@I?oj4XF8;}^we?56xg@i{HYuLU!-%0lrE)orM3V09IJUog&vYySb$Pzad- literal 0 HcmV?d00001 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 +}