QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#594194 | #9307. Clock Master | zqx# | RE | 1ms | 3980kb | C++23 | 1.2kb | 2024-09-27 20:10:01 | 2024-09-27 20:10:02 |
Judging History
answer
#include<bits/stdc++.h>
#define AC return 0;
#define int long long
#define pii pair<int,int>
#define all(tar) tar.begin(),tar.end()
const int maxx=306;
const int mod=998244353;
using namespace std;
int n,m,t;
vector<int>num;
bool vis[maxx];
double dp[2][maxx];
int opt;
void init(){
for(int i=2;i<maxx;i++){
if(!vis[i]){
num.push_back(i);
for(int j=i;j<maxx;j+=i)vis[j]=1;
}
}
dp[0][0]=0;
for(auto x:num){
opt^=1;
double z=log(x);
double a=z;
for(int y=x;y<maxx;y*=x,z+=a){
for(int j=0;j+y<maxx;j++){
// if(y==3)cout<<j<<'\n';
dp[opt][j+y]=max(dp[opt][j+y],dp[opt^1][j]+z);
// if(y==3&&j==4){
// cout<<dp[opt][j+y]<<"Ssss"<<'\n';
// }
}
}
for(int j=1;j<maxx;j++){
dp[opt][j]=max({dp[opt][j],dp[opt^1][j],dp[opt][j-1]});
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
init();
cin>>t;
while(t--){
cin>>n;
printf("%.8lf\n",dp[opt][n]);
}
AC
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3980kb
input:
3 2 7 10
output:
0.69314718 2.48490665 3.40119738
result:
ok 3 numbers
Test #2:
score: -100
Runtime Error
input:
5000 580 4555 4654 1420 53 1076 1226 2733 2285 348 2104 2293 3447 4208 710 307 1763 1142 3027 2151 3182 1546 3398 867 2380 830 4211 3117 3058 2251 1890 3961 4003 3991 4167 4976 1765 3235 2644 4070 4644 3645 875 3005 4769 4934 3846 2941 255 946 4164 1372 1193 3056 4472 508 3949 2473 4490 88 4014 2953...