Rezultati

Up. imeNalogaJezikRezultatČas oddaje
marko Niz C++ 100/100OK 19. apr '18 @ 16:48

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,113 MiB 0,000 s OK
#2 10/10 3,113 MiB 0,010 s OK
#3 10/10 3,297 MiB 0,040 s OK
#4 10/10 3,160 MiB 0,040 s OK
#5 10/10 3,160 MiB 0,034 s OK
#6 10/10 3,301 MiB 0,034 s OK
#7 10/10 3,301 MiB 0,016 s OK
#8 10/10 3,301 MiB 0,034 s OK
#9 10/10 3,305 MiB 0,034 s OK
#10 10/10 3,301 MiB 0,028 s OK

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

using namespace std;

int main()
{
    string niz;
    int n;
    cin>>n;
    string temp = "";
    cin>>niz;
    int stev = 0;
    for(int i=0; i< n-2; i++)
    {
        temp = "";
        temp =temp + niz[i]+niz[i+1]+niz[i+2];
        if(temp=="010")
        {
            niz[i+2]='1';
            stev++;
             i+= 2;
        }
    }
    cout << stev;
}