Advertisement
_the_elf_

Ten.java

Oct 27th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. import static java.lang.Math.sqrt;
  4.  
  5. public class Ten
  6. {
  7.     public static void main(String[] args)
  8.     {
  9.         Scanner in = new Scanner(System.in);
  10.         int n = in.nextInt();
  11.         double[] a = new double[n];
  12.         for (int i = 0; i < n; i++)
  13.             a[i] = (int)in.nextDouble();
  14.         for (double anA : a)
  15.         {
  16.             double x = (-1 - sqrt(1 - 8 * (1 - anA)));
  17.             if (x == (int) x) System.out.print("1 ");
  18.             else System.out.print("0 ");
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement