Advertisement
erfanul007

Timus 1209

Oct 29th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5. int t,num,i;
  6. long long sum;
  7. scanf("%d",&t);
  8. for(i=0;i<t;i++){
  9. scanf("%d",&num);
  10. sum=(long long)sqrt((unsigned int)(num-1)*2);
  11. sum=sum*(sum+1)/2+1;
  12. if(sum==num)printf("1");
  13. else printf("0");
  14. if(i!=t-1)
  15. printf(" ");
  16. }
  17. printf("\n");
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement