Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int n,i,y,x,t,z,c,mn,mx,t1,t2,nou;
  5. int main()
  6. {
  7.     cin>>t;
  8.     t1=0;
  9.     t2=0;
  10.     if(t==1)
  11.     {
  12.         cin>>n;
  13.         for(i=1; i<=n; i++)
  14.         {
  15.             cin>>x;
  16.             y=x;
  17.             mn=10;
  18.             mx=0;
  19.             while(y>0)
  20.             {
  21.                 c=x%10;
  22.                 if(c>mx)
  23.                 {
  24.                     mx=c;
  25.                 }
  26.                 if(c<mn)
  27.                 {
  28.                     mn=c;
  29.                 }
  30.                 y/=10;
  31.             }
  32.             nou=0;
  33.             while(x>0)
  34.             {
  35.                 c=x%10;
  36.                 if(c=mn and nou==0)
  37.                 {
  38.                     nou=mn;
  39.                 }
  40.                 if(c=mn and nou ==mx)
  41.                 {
  42.                     nou=10*mn+nou;
  43.                 }
  44.                 if(c==mx and nou==0)
  45.                 {
  46.                     nou=mx;
  47.                 }
  48.                 if(c==mx and nou==mn)
  49.                 {
  50.                     nou=10*mx+nou;
  51.                 }
  52.                 x=x/10;
  53.             }
  54.             if(nou%10>nou/10%10)
  55.             {
  56.                 t1=t1+1;
  57.             }
  58.         }
  59.         cout<<t1;
  60.     }
  61.    
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement