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
22 lines
502 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main() {
|
|
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)
|
|
break;
|
|
tmp = (tmp - x) / n * (n - 1);
|
|
}
|
|
if (j == n) {
|
|
printf("%d\n", i);
|
|
exit(0);
|
|
}
|
|
}
|
|
printf("thats too more!");
|
|
return 0;
|
|
} |