Advertisement
madidino

teza7-sub3-3

Nov 12th, 2023 (edited)
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <fstream>
  4. using namespace std;
  5. int main()
  6. {
  7.    ifstream fin("BAC.IN");
  8.    ofstream fout("BAC.OUT");
  9.    int x;
  10.    int v[10];
  11.    for(int i=0;i<=9;i++)
  12.    {
  13.        v[i]=0;
  14.    }
  15.    while(fin>>x)
  16.    {
  17.        x=log10(x);
  18.        v[x]++;
  19.    }
  20.    fin.close();
  21.    for(int i=0;i<=9;i++)
  22.    {
  23.        while(v[i])
  24.        {
  25.            fout<<pow(10,i)<<" ";
  26.            v[i]--;
  27.        }
  28.    }
  29.    fout.close();
  30.    return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement