Rezultati

Up. imeNalogaJezikRezultatČas oddaje
pokosimo-2018 Sveti gral C++ 100/100OK 10. maj '18 @ 17:08

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 3,219 MiB 0,000 s OK
#2 5/5 3,164 MiB 0,000 s OK
#3 5/5 3,164 MiB 0,004 s OK
#4 5/5 3,164 MiB 0,004 s OK
#5 5/5 3,219 MiB 0,004 s OK
#6 5/5 3,285 MiB 0,000 s OK
#7 5/5 3,164 MiB 0,000 s OK
#8 5/5 3,219 MiB 0,004 s OK
#9 6/6 3,164 MiB 0,004 s OK
#10 6/6 3,219 MiB 0,000 s OK
#11 6/6 3,164 MiB 0,004 s OK
#12 6/6 3,219 MiB 0,000 s OK
#13 6/6 3,219 MiB 0,004 s OK
#14 6/6 3,219 MiB 0,004 s OK
#15 6/6 3,215 MiB 0,004 s OK
#16 6/6 3,215 MiB 0,000 s OK
#17 6/6 3,215 MiB 0,004 s OK
#18 6/6 3,164 MiB 0,000 s OK

Ocenjevani program (igrala.cpp):
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>

using namespace std;

bool preveri(int i, int n) {
    int rez = 0, a = i;
    while(a > 0) {
        rez += a % 10;
        a/= 10;
    }
    return rez + i == n;
}

int main() {
    int stevilo;
    scanf("%d", &stevilo);
    //cin >> stevilo;
    vector<int> tab;
    for(int i=max(stevilo-100, 1); i<stevilo; ++i) {
        if(preveri(i, stevilo)) {
            tab.push_back(i);
        }
    }
    //cout << tab.length() << endl;
    
    printf("%d\n", tab.size());
    for(int i=0; i<tab.size(); ++i) {
        printf("%d\n", tab[i]);
    }
    return 0;
}