|
|
вернуться в форумplz tell me why my answer is wrong //i try to run the code passed, i seems it make the same answer as me //i don't know what's wrong accur,plz help me.Does there is any wrong in way i solve this problem? import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner ( System.in ); int a,temp;//count store time of test //find 1,1 is easy to find //1 is at (n+1)n/2 +1 int count=cin.nextInt(); for (int j=1; j<=count; j++) { a=cin.nextInt(); temp=(int) Math.floor(Math.sqrt(2*(j-1))); if((temp*(temp+1)/2+1)==j){ System.out.print("1 "); }else { System.out.print("0 "); } } } } |
|
|