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

Why i am getting WA at test 1
Posted by Tazma 21 Aug 2019 01:36
#include<bits/stdc++.h>
using namespace std;
const long long size=65535;
long long ara[size];
long long b[size];
Find()
{
    long long i, sum=1, j;
    for(i=0, j=1; i<=size; i++, j++)
    {
        sum=sum+i;
        ara[j]=sum;

    }

}
int main()
{
    long long i, n, a, r, j;
    Find();
    cin>>a;
    for(i=1; i<=a; i++)
    {
        cin>>b[i];
    }
    for(i=1; i<=a; i++)
    {
        r=0;

        for(j=1; j<=size; j++)
        {
            if(b[i]==ara[j])
            {
                r=1;
                break;
            }
        }
        if(r==1)
        {
            printf("1 ");
        }
        else
        {
            printf("0 ");
        }


    }
    printf("\n");

    return 0;
}