Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n,i,y,x,t,z,c,mn,mx,t1,t2,nou;
- int main()
- {
- cin>>t;
- t1=0;
- t2=0;
- if(t==1)
- {
- cin>>n;
- for(i=1; i<=n; i++)
- {
- cin>>x;
- y=x;
- mn=10;
- mx=0;
- while(y>0)
- {
- c=x%10;
- if(c>mx)
- {
- mx=c;
- }
- if(c<mn)
- {
- mn=c;
- }
- y/=10;
- }
- nou=0;
- while(x>0)
- {
- c=x%10;
- if(c=mn and nou==0)
- {
- nou=mn;
- }
- if(c=mn and nou ==mx)
- {
- nou=10*mn+nou;
- }
- if(c==mx and nou==0)
- {
- nou=mx;
- }
- if(c==mx and nou==mn)
- {
- nou=10*mx+nou;
- }
- x=x/10;
- }
- if(nou%10>nou/10%10)
- {
- t1=t1+1;
- }
- }
- cout<<t1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement