2 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main() { int res; cin>>res; int a=res/100; int b=res/10%10; int c=res%10; int cnt=0; if(res==495) { cout<<'0'; return 0; } do { a=res/100; b=res/10%10; c=res%10; int x1,x2,x3,x4,x5,x6; x1=a*100+b*10+c*1; x2=a*100+c*10+b*1; x3=b*100+a*10+c*1; x4=b*100+c*10+a*1; x5=c*100+a*10+b*1; x6=c*100+b*10+a*1; int maxv; maxv=max({x1,x2,x3,x4,x5,x6}); int minv; minv=min({x1,x2,x3,x4,x5,x6}); res=maxv-minv; if(res==495) { cnt++; break; } else { cnt++; continue; } }while(1); cout<<cnt; return 0; }
- 1
Information
- ID
- 1178
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 9
- Tags
- (None)
- # Submissions
- 15
- Accepted
- 3
- Uploaded By