1 solutions
-
1
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int cnt=0; while(n!=495) { int g=n%10; int s=n/10%10; int b=n/100%10; if(g>s) swap(g,s); if(g>b) swap(g,b); if(s>b) swap(s,b); int maxv=b*100+s*10+g; int minv=g*100+s*10+b; n=maxv-minv; cnt++; } cout<<cnt; return 0; }
- 1
Information
- ID
- 1178
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- (None)
- # Submissions
- 90
- Accepted
- 23
- Uploaded By