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

Discussion of Problem 1209. 1, 10, 100, 1000...

Where i am wrong?
Posted by Volov_Forever 15 Apr 2009 01:44
Where i am wrong?


#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
    double n,i,a,f,m;
    cin>>n;
    for (i=1;i<=n;i++)
    {
        cin>>a;
        m=sqrt (8*a-7);
        f=int (m);
        if (m==f) cout<<"1";
        else cout<<"0";
    }
}
Re: Where i am wrong?
Posted by Fastholf 23 Oct 2010 11:21
Volov_Forever wrote 15 April 2009 01:44
f = int(m);
f = ceil(m);
Volov_Forever wrote 15 April 2009 01:44
m=sqrt (8*a-7);
m = [sqrt(8.0*a-7.0)-1.0]/2.0

Edited by author 23.10.2010 11:26