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.
python/GESP/New_WuHouFenTao_2.cpp

20 lines
526 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j;
for (i = 6;; i += 5) {
int x = i;
for (j = 0; j < 5; j++) {
if ((x - 1) % 5 != 0 || x <= 1) // 扔掉一个是否能分成5份
break; // 不符合要求
x = (x - 1) / 5 * 4; // 分完第j+1次后剩下的桃子
}
if (j == 5) { // 符合条件
printf("%d", i);
exit(0);
}
}
return 0;
}