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

the result is correct but access violation
Posted by xinxin 8 Sep 2016 19:38
#include<stdio.h>
#include<string.h>
int main()
{
    int n,i=0,j=0;
    int a[65535];
    int b[65535]={0};
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    i=0;
    while(j<65535)
    {
        j=j+i;
        b[j]=1;
        i++;
    }
    for(i=0;i<n;i++)
        printf("%d ",b[a[i]-1]);
    return 0;
}
can you help me?
Re: the result is correct but access violation
Posted by ToadMonster 9 Sep 2016 12:38
Value of Ki - a[i] in your program - is up to 2^31-1.