This problem test instructions:
Ask greatest common divisor, greatest common divisor is 1, then good, otherwise bad
Attention:
If the output is System.out.printf ("%10d%10d good choice\n\n", step,mod), the presentation Error will be reported.
The AC output is:
System.out.printf ("%10d%10d good Choice", step,mod);
System.out.println ();
System.out.println ();
Don't ask me why, I don't know, a wry smile ~
Here's the Java code:
ImportJava.util.*;ImportJava.io.*; Public classmain{ Public Static voidMain (string[] arg) {Scanner Scan=NewScanner (NewBufferedinputstream (system.in)); intStep,mod; while(Scan.hasnextint ()) {Step=Scan.nextint (); MoD=Scan.nextint (); if(GETGCD (Step,mod) ==1) {System.out.printf ("%10d%10d Good Choice", Step,mod); System.out.println (); System.out.println (); }Else{System.out.printf ("%10d%10d Bad Choice", Step,mod); System.out.println (); System.out.println (); }} scan.close (); } Static intGETGCD (intSmallintbig) { inttemp =Small; while(temp = big%small)!=0) {Big=Small; Small=temp; } returnSmall; }}
hdoj-acm1014 (JAVA)