Facebook
From dsadsa, 2 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 198
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("atestat.in");
  5. ofstream fout("atestat.out");
  6. int main()
  7. {
  8.     int n,cn=n,x=0,min=99999999,p=1;
  9.     fin>>n;
  10.     while(n>9){
  11.         x=(n/10)*p+cn%p;
  12.         if(x<min)min=x;
  13.         n/=10;
  14.         p*=10;
  15.     }
  16.     fout<<min;
  17.     return 0;
  18.  
  19. }
  20.