|
|
back to boardWA#3 what is test 3. please, any hint Re: WA#3 what is test 3. Help Me Please. WA#2 what is test 2. My Code: import java.util.Scanner; public class Rubbits { public static void main(String[] args) { Scanner rb = new Scanner(System.in); int n = rb.nextInt(); long [] a = new long [n]; int i,j,k,m; for ( i = 0; i < n; i++) { a[i] = rb.nextInt(); } for ( i = 0; i <n; i++) { if (a[i]==1){ System.out.println("0");
} else if(a[i]==2) System.out.println("1"); else{ for ( j =2; j < a[i]; j++) { k =(int)a[i]/j; m = k*j; if (a[i]-m>=k) { System.out.println(j); break; } }
} } } } Re: WA#3 what is test 3. Posted by Quyon 19 Aug 2009 09:18 test #2 n=1 output 2 n=2 output 3 n=3 output 2 Re: WA#3 what is test 3. Posted by Quyon 19 Aug 2009 09:19 test #3 n=2 output 3 |
|
|