Advertisement
35657

Untitled

Oct 12th, 2024
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8.  
  9.     ifstream fin("input.txt");
  10.  
  11.     int colors[3]{};
  12.  
  13.     int size;
  14.     fin >> size;
  15.  
  16.     int temp;
  17.  
  18.     for (int i = 0; i < size; i++) {
  19.         fin >> temp;
  20.         colors[temp]++;
  21.     }
  22.  
  23.     for (int i = 0; i < 3; i++) {
  24.         for (int j = 0; j < colors[i]; j++) {
  25.             cout << i << " ";
  26.         }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement