Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Deathmask Sveti gral C++ 100/100OK 10. maj '18 @ 17:40

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 3,141 MiB 0,004 s OK
#2 5/5 2,996 MiB 0,004 s OK
#3 5/5 3,141 MiB 0,004 s OK
#4 5/5 3,137 MiB 0,000 s OK
#5 5/5 3,137 MiB 0,004 s OK
#6 5/5 3,137 MiB 0,000 s OK
#7 5/5 3,008 MiB 0,000 s OK
#8 5/5 3,137 MiB 0,004 s OK
#9 6/6 3,141 MiB 0,004 s OK
#10 6/6 3,137 MiB 0,000 s OK
#11 6/6 3,137 MiB 0,000 s OK
#12 6/6 2,996 MiB 0,000 s OK
#13 6/6 3,000 MiB 0,000 s OK
#14 6/6 3,129 MiB 0,004 s OK
#15 6/6 3,137 MiB 0,004 s OK
#16 6/6 2,996 MiB 0,000 s OK
#17 6/6 3,004 MiB 0,004 s OK
#18 6/6 3,137 MiB 0,000 s OK

Ocenjevani program (main.cpp):
#include <iostream>


using namespace std;

int main()
{
    long n;
    int counter=0;
    cin>>n;
    long arr[1000000];
    for(long i=n;i>=n/2;i--)
    {
        long a = i;
        long sum = 0;
        int c;
        long k=0;
        while(a!=0)
        {
            c=a%10;
            k=k+9;
            a/=10;
            sum+=c;
        }

        if (i<n-k)
        break;
        if(n-sum==i){
            arr[counter]=i;
            counter++;
        }
    }

    cout<<counter<<endl;
    if(counter >0)
    {
    for (int i=counter - 1;i>=0;i--)
        cout<<arr[i]<<endl;
    }
    return 0;
}