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...

DeDaRm WA 3 ---->C++ pls help // Problem 1209. 1, 10, 100, 1000... 5 Dec 2013 19:32
#include <iostream>
#include <cmath>
using namespace std;

int main ()
{
    int x,e;
    double nk;
    cin >> x;
    int *b=new int[x];
    for (e=0; e<x; ++e)
    {
        cin >> b[e];
    }
    for (e=0 ; e<x; ++e )
    {
        nk = (pow((8*b[e]-7),0.5)-1)/2;
        long int k = static_cast< int >( nk );
        if ( nk==k )
        {
            cout << "1 ";
        }
        else
        {
            cout << "0 ";
        }
    }
    system ("pause > void");
}

Edited by author 05.12.2013 19:32