JosepRivaille

P14130: Igual a l'últim

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