ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Why can't I use sqrt() ?
Posted by mag 10 Jan 2003 18:33
Hi.

I've included <math.h> and have tried to use sqrt(). Why I wasn't
allowed to do this and have got CE?

Source code follows:

#include <stdio.h>
#include <math.h>
int getint() { int i; scanf("%d", &i); return i; }

int main()
{
  int i = getint();
  while(i--)
  {
    int n = getint() - 1;
    int nn = sqrt(n+n);

    if(nn*(nn+1) == n+n)
      printf("1\n");
    else
      printf("0\n");
  }
}