Advertisement
SergeyPGUTI

5.2.11

Oct 23rd, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2.  using namespace std;
  3.  int main()
  4.  {
  5.      int a[100];
  6.      int n;
  7.      int num=1;
  8.      cin>>n;
  9.      for (int i=0;i<n;i++)
  10.      {
  11.          cin>>a[i];
  12.      }
  13.  
  14.  
  15.      for(int i=1;i<n;i++)
  16.      {
  17.          if (a[i]!=a[i-1]) num++;
  18.      }
  19.  
  20.  
  21.       cout<<num;
  22.  
  23.  return 0;
  24.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement