Paint The Tiles

  • + 1 comment

    using System.CodeDom.Compiler; using System.Collections.Generic; using System.Collections; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.Serialization; using System.Text.RegularExpressions; using System.Text; using System;

    class Solution {

    static int StrokesToPaint(int N,string[] C)
    {
       //C = new string[N];
       int count=1;
    
    
      for(int i=0; i<=(N-1); i++)
       {
          if(i!=4)
           {
               if(C[i] != C[i+1])
               {
                   count = count+1;
               }               
            }           
       }
    
        return count;
    
    }
    
    static void Main(string[] args) {
    
         TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true);
    
        int N = Convert.ToInt32(Console.ReadLine());
    
        //string[] C = new string[N];
    
       string[] C = Array.ConvertAll(Console.ReadLine().Split(' '), aTemp => 
       Convert.ToString(aTemp));      
    
        //string C = Console.ReadLine();       
    
        int count=StrokesToPaint(N,C);  
    
        //Console.WriteLine(count);
    
        textWriter.WriteLine(count);
    
        textWriter.Flush();
        textWriter.Close();  
    
    }
        }
    

    }