T3000

Problema F

Oct 21st, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x;
  8.     cin>>x;
  9.  
  10.     while(x>99){
  11.             if(x==1000){
  12.                 x=1;
  13.             }
  14.         if(x>99 && x<1000){
  15.             if(x%100==0){
  16.                 x=x/100;
  17.             }else if(x%10==0) {
  18.             x=(x/100)*((x/10)%10);
  19.             }else if((x/10)%10==0){
  20.             x=(x/100)*(x%10);
  21.             }
  22.  
  23.  
  24.  
  25.     }
  26.     }
  27.     while(x<100 && x>9){
  28.     if(x<100 && x>9){
  29.           if(x%10==0){
  30.             x=x/10;
  31.           }else{
  32.             x=(x/10)*(x%10);
  33.           }
  34.  
  35.           }
  36.     }
  37.  
  38.  
  39.     cout<<x<<endl;
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment