- 游戏
P398 RE 30pts 求调
- 2023-4-6 20:51:04 @
如题。
#include "bits/stdc++.h"
using namespace std;
int f[70000000];
int main() {
int x, y, mx = -0x7fffffff, mn = 0x7fffffff;
scanf ("%d%d", &x, &y);
//freopen ("oeis.txt", "w", stdout);
f[1] = 1;
for (int i = 2; i <= y; ++i) {
int j = i, cnt = 1;
while (j > 30000005 || !f[j]) {
if (j % 2) j = j * 3 + 1;
else j = j / 2;
if (j > 30000005 || !f[j]) ++cnt;
else cnt += f[j];
}
f[i] = cnt;
//cout << f[i] << ' ';
}
for (int i = x; i <= y; ++i) mx = max(mx, f[i]), mn = min(mn, f[i]);
cout << mn << ' ' << mx << endl;
}
0 条评论
目前还没有评论...