duonglee

BCBEADS - Đếm hạt

Jul 1st, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. /*
  2.     Darkness
  3. */
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9.     // In;
  10.     int N;
  11.     cin>>N;
  12.     int Arr[N+1];
  13.     for (int i=1; i<=N; i++)
  14.     {
  15.         cin>>Arr[i];
  16.     }
  17.     // Out
  18.     int count=0;
  19.     for (int i=1; i<N; i++)
  20.     {
  21.         if (Arr[i]!=Arr[i+1])
  22.         {
  23.             count++;
  24.         }
  25.     }
  26.     cout<<count;
  27.    
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment