Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 3,176 MiB 0,000 s OK
#2 5/5 3,176 MiB 0,004 s OK
#3 5/5 3,109 MiB 0,004 s OK
#4 5/5 3,113 MiB 0,000 s OK
#5 5/5 3,113 MiB 0,000 s OK
#6 5/5 3,176 MiB 0,004 s OK
#7 5/5 3,043 MiB 0,004 s OK
#8 5/5 3,176 MiB 0,004 s OK
#9 6/6 3,043 MiB 0,004 s OK
#10 6/6 3,043 MiB 0,004 s OK
#11 6/6 3,176 MiB 0,004 s OK
#12 6/6 3,176 MiB 0,000 s OK
#13 6/6 3,172 MiB 0,004 s OK
#14 6/6 3,176 MiB 0,004 s OK
#15 6/6 3,039 MiB 0,000 s OK
#16 6/6 3,043 MiB 0,004 s OK
#17 6/6 3,172 MiB 0,004 s OK
#18 6/6 3,176 MiB 0,004 s OK

Ocenjevani program (killerrabit.cpp):
#include <iostream>
#include <string.h>
#include <deque>
#include <sstream>

using namespace std;

int main()
{
    string stevilo;
    cin >> stevilo;
    deque<int> polje; //pravilne opcije


    stringstream ss;
    //stringstream ss1;
    string teststr;

    ss << stevilo;
    int koncno;
    ss >> koncno;

    int test = 1;
    int uspelih = 0;


    for(int i = 0; i < 100; i++){
        stringstream ss1;
        test = koncno - i -1;
        ss1 << test;
        ss1 >> teststr;

        if(test == 0){
            if(uspelih == 0){
                cout << 0 << endl;
                return 0;
            }else{
                cout << uspelih << endl;
                for(int u = 0; u < polje.size(); u++)
                    cout << polje[u] << endl;
                return 0;
            }
        }

        for(int z = 0; z < teststr.length(); z++){
                //cout << - '0' + teststr[z] << endl;
                test = test - '0' + (char)teststr[z];
        }

        if(test == koncno){
            uspelih++;
            polje.push_front(koncno - i -1);
        }
    }

    if(uspelih == 0){
                cout << 0 << endl;
                return 0;
            }else{
                cout << uspelih << endl;
                for(int u = 0; u < polje.size(); u++)
                    cout << polje[u] << endl;
            }
    return 0;
}