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
502 B

1 year ago
#include <bits/stdc++.h>
1 year ago
using namespace std;
int main() {
1 year ago
int i = 0, j = 0;
int x, n;
cin >> n >> x;
int tmp = 0;
for (i = 1; i <= 100000000; i++) {
tmp = i;
for (j = 0; j < n; j++) {
if ((tmp - x) % n != 0 || tmp <= x)
1 year ago
break;
1 year ago
tmp = (tmp - x) / n * (n - 1);
1 year ago
}
1 year ago
if (j == n) {
printf("%d\n", i);
exit(0);
1 year ago
}
}
1 year ago
printf("thats too more!");
return 0;
1 year ago
}