QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#696286#9307. Clock MasterBlizzardRE 0ms0kbC++231.7kb2024-10-31 22:01:352024-10-31 22:01:40

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 22:01:40]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-10-31 22:01:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

//--------------------------------
// #define int long long
#define LL long long
// #define lc p << 1
// #define rc p << 1 | 1
#define lowbit(x) x & (-x)
#define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++)
#define Blizzard ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"

//-----------------------------------------
const int N = 3e4 + 10;
double f[N];
double a[N];
int pri[N], vis[N * 10 + 32];
int cnt;
void inti()
{
    for (int i = 1; i <= N; i++)
    {
        a[i] = log(i);
    }
    for (int i = 2; i < N * 10; i++)
    {
        if (!vis[i])
        {
            vis[i] = 1;
            pri[++cnt] = i;
        }
        for (int j = 1; j <= cnt && 1LL * i * pri[j] <= N; j++)
        {
            vis[i * pri[j]] = 1;
            if (i % pri[j] == 0)
                break;
        }
    }

    // for (int i = 1; i <= 10; i++)
    //     cout << pri[i] << " \n"[i == 10];
    // cout << cnt << '\n';
    for (int i = 1; i <= cnt; i++)
    {
        for (int j = N - 3; j >= pri[i]; j--)
        {
            for (int k = pri[i]; k <= j; k *= pri[i])
            {
                f[j] = max(f[j], f[j - k] + a[k]);
            }
        }
    }
}
void solve()
{
    int x;
    cin >> x;
    cout << fixed << setprecision(10) << f[x] << '\n';
}

signed main()
{
    //	freopen("in.txt", "r", stdin);
    //	freopen("out.out", "w", stdout);
    Blizzard; // false
    int t = 1;
    cin >> t;
    inti();
    while (t--)
        solve();
    return 0;
}
/*
while (l < r)
    {
        int mid = l + r >> 1;
        if (check(mid)) r = mid;
        else l = mid + 1;
    }
*/

詳細信息

Test #1:

score: 0
Runtime Error

input:

3
2
7
10

output:


result: