csansoon

P7.01 P14130 Equal to the last one

Nov 12th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     int total=0;
  8.     cin>>n;
  9.     vector <int> v (n);
  10.     for (int i=0; i<n; i++) cin>>v[i];
  11.     for (int i=0; i<(n-1); i++) if (v[i]==v[n-1]) total++;
  12.     cout<<total<<endl;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment