Advertisement
TwITe

Untitled

Aug 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <utility>
  5. #include <iterator>
  6. #include <set>
  7. using namespace std;
  8.  
  9. int main() {
  10.     int customer_size, n;
  11.     cin >> customer_size >> n;
  12.     set <int> shoes;
  13.     for (int i = 0; i < n; i++) {
  14.         int current_shoes;
  15.         cin >> current_shoes;
  16.         shoes.insert(current_shoes);
  17.     }
  18.     int correct_shoes = 0;
  19.     for (auto current_shoes : shoes) {
  20.         if (current_shoes - customer_size >= 0 && correct_shoes == 0) {
  21.             correct_shoes++;
  22.             customer_size = current_shoes;
  23.         }
  24.         if (current_shoes - customer_size >= 3) {
  25.             correct_shoes++;
  26.             customer_size = current_shoes;
  27.         }
  28.     }
  29.     cout << correct_shoes;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement