Rezultati

Up. imeNalogaJezikRezultatČas oddaje
AlenVerk-2018 Niz C# 100/100OK 19. apr '18 @ 18:29

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 17,977 MiB 0,000 s OK
#2 10/10 20,422 MiB 0,000 s OK
#3 10/10 18,766 MiB 0,000 s OK
#4 10/10 18,777 MiB 0,000 s OK
#5 10/10 18,695 MiB 0,000 s OK
#6 10/10 20,762 MiB 0,000 s OK
#7 10/10 20,738 MiB 0,000 s OK
#8 10/10 18,742 MiB 0,000 s OK
#9 10/10 18,773 MiB 0,000 s OK
#10 10/10 20,762 MiB 0,000 s OK

Ocenjevani program (Program.cs):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace niz
{
    class Program
    {
        static void Main(string[] args)
        {
            int n=int.Parse(Console.ReadLine());
            string ni = Console.ReadLine();
            char[] niz = ni.ToCharArray();

            for(int i=0;i<niz.Length-2;i++)
            {
                if(niz[i]=='0'&& niz[i+1] == '1' && niz[i+2] == '0')
                {
                    niz[i + 2] = '1';
                }
            }
            int j = 0;
            for(int o=0;o<niz.Length;o++)
            {
                if(niz[o]!=ni[o])
                {
                    j++;
                }
            }
            Console.WriteLine(j);
        }
    }
}