Advertisement
Guest User

Susi's Water Bottle

a guest
Sep 20th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main() {
  7.     int t, n, y, x, z;
  8.     vector<int> num;
  9.     cin >> t;
  10.     for(int i = 1; i <= t; i++) {
  11.         cin >> n;
  12.         for(n; n > 0; n--) {
  13.             cin >> y;
  14.             num.push_back(y);
  15.         }
  16.         cin >> x;
  17.         cout << "Kasus #" << i << ": ";
  18.         z = count(num.begin(), num.end(), x);
  19.         if(z != 0)
  20.             cout << "ADA " << z << " BOTOL DITEMUKAN" << endl;
  21.         else
  22.             cout << "TIDAK ADA" << endl;
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement