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

Test #3, си
Posted by pavel6520 16 Jan 2018 00:30
Не проходит Тест 3.
из темы http://acm.timus.ru/forum/thread.aspx?id=40287&upd=636486286708718852 взял условие, на компьютере все в порядке, отсылаю в тимус: Time limit exceeded

#include <stdio.h>
int mas[99999];
long int i, n;
unsigned long int a, cou = 0, s = 0;
int main()
{
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%u", &a);
        cou = 0; s = 1;
        while(s < a){
            cou++;
            s = s + cou;
        }
        if (a == s){
            mas[i] = 1;
        } else {
            mas[i] = 0;
        }

    }
    for (i = 0; i < n; i++){
        printf("%d ", mas[i]);
    }
    return 0;
}

Подскажите пожалуйста что не так.
Re: Test #3, си
Posted by Mr.Creative 12 Feb 2018 04:22
your mass[99999] must be 'long long'. Because Ki <= (1 << 31) - 1;