Advertisement
STANAANDREY

bacT14 SIII 3

May 24th, 2021
1,078
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <limits.h>
  4. using namespace std;
  5. ifstream fin("bac.in");
  6.  
  7. int main() {
  8.     int mins[3];
  9.     mins[0] = mins[1] = mins[2] = INT_MAX;
  10.     for (int x; fin >> x;) {
  11.         if (x % 100 == 20) {
  12.             if (x < mins[0]) {
  13.                 mins[2] = mins[1];
  14.                 mins[1] = mins[0];
  15.                 mins[0] = x;
  16.             } else if (x < mins[1]) {
  17.                 mins[2] = mins[1];
  18.                 mins[1] = x;
  19.             } else if (x < mins[2]) {
  20.                 mins[2] = x;
  21.             }
  22.         }
  23.     }
  24.     for (int i = 0; i < 3; i++) {
  25.         cout << mins[i] << ' ';
  26.     }
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement