You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
476 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 10;
int a[N];
int main() {
int n;
cin >> n;
int cnt = 0;
while (true) {
cnt++;
1 year ago
a[0] = n / 100;
a[1] = n % 100 / 10;
a[2] = n % 10;
sort(a, a + 3);
int mx = a[2] * 100 + a[1] * 10 + a[0];
int mi = a[0] * 100 + a[1] * 10 + a[2];
2 years ago
n = mx - mi;
if (n == 495) break;
}
cout << cnt << endl;
return 0;
}