Rezultati

Up. imeNalogaJezikRezultatČas oddaje
DROPTABLE-2017 Hodnik C# 100/100OK 20. apr '17 @ 16:28

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 18,637 MiB 0,000 s OK
#2 10/10 18,563 MiB 0,000 s OK
#3 10/10 18,648 MiB 0,000 s OK
#4 10/10 20,574 MiB 0,000 s OK
#5 10/10 20,574 MiB 0,000 s OK
#6 10/10 20,582 MiB 0,000 s OK
#7 10/10 20,574 MiB 0,000 s OK
#8 10/10 20,566 MiB 0,000 s OK
#9 10/10 18,652 MiB 0,000 s OK
#10 10/10 20,570 MiB 0,000 s OK

Ocenjevani program (Program.cs):
using System;

namespace csharp_template {
  class Program {
    static void Main(string[] args) {
      var str = Console.ReadLine();
      int countOn = 0;
      int countOff = 0;
      bool negiraj = false;
      foreach (var c in str) {
        bool tajeon = negiraj ? c == '0' : c == '1';
        if (tajeon) countOn++;
        else countOff++;
        negiraj = !negiraj;
      }
      Console.Write(Math.Min(countOff, countOn));
    }
  }
}