Rezultati

Up. imeNalogaJezikRezultatČas oddaje
formule-2018 Sveti gral C 100/100OK 10. maj '18 @ 19:16

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 1,465 MiB 0,000 s OK
#2 5/5 1,492 MiB 0,000 s OK
#3 5/5 1,469 MiB 0,000 s OK
#4 5/5 1,469 MiB 0,000 s OK
#5 5/5 1,469 MiB 0,000 s OK
#6 5/5 1,492 MiB 0,000 s OK
#7 5/5 1,484 MiB 0,000 s OK
#8 5/5 1,496 MiB 0,000 s OK
#9 6/6 1,496 MiB 0,000 s OK
#10 6/6 1,465 MiB 0,000 s OK
#11 6/6 1,461 MiB 0,000 s OK
#12 6/6 1,469 MiB 0,000 s OK
#13 6/6 1,492 MiB 0,000 s OK
#14 6/6 1,496 MiB 0,000 s OK
#15 6/6 1,496 MiB 0,000 s OK
#16 6/6 1,465 MiB 0,000 s OK
#17 6/6 1,469 MiB 0,000 s OK
#18 6/6 1,465 MiB 0,000 s OK

Ocenjevani program (Gral.c):
#include <stdio.h>
#include <stdlib.h>

int main(void) 
{
    long int n, temp;
    long int a[n];
    long int vsota = 1;
    scanf("%ld", &n);
    int count = 0;
    int stevke=1;
    long int ni = n;
    while(ni/10 != 0){
        stevke++;
        ni=ni/10;
    }
    for(int i = n - 9*(stevke); i < n; i++){
        temp=i;
        vsota = i;
        while(temp/10 != 0){
            vsota = vsota + temp%10; 
            temp = temp/10;
        }
        temp = temp%10;
        if(vsota+temp == n){
            count++;
            a[count-1] = i;
            i++;
        }
    }
    printf("%d\n", count);
    int j = 0;
    for (int j = 0; j < count; ++j)
    {
        printf("%ld\n", a[j]);
    }
    
    return 0;
}