QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#570764 | #9307. Clock Master | retired_midlights | AC ✓ | 63ms | 4860kb | C++14 | 1004b | 2024-09-17 17:39:08 | 2024-09-17 17:39:10 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (int)a; i <= (int)b; i ++)
#define ll long long
using namespace std;
const int maxn = 30010;
double dp[maxn], val[maxn], ndp[maxn];
bool check(int x) {
for(int i = 2; i * i <= x; i ++)
if(x % i == 0) return 0;
return 1;
}
void prework() {
vector < int > primes;
int n = 30000;
rep(i, 2, n) if(check(i)) primes.push_back(i);
rep(i, 1, n) val[i] = log(i);
for(auto p : primes) {
int cur = p, cnt = 1;
for(int i = cur; i <= n; i *= cur, cnt ++) {
for(int j = i; j <= n; j ++)
ndp[j] = max(ndp[j], dp[j - i] + cnt * val[p]);
}
memcpy(dp, ndp, sizeof(dp));
}
}
void solve() {
int b;
cin >> b;
cout << fixed << setprecision(12) << dp[b] << "\n";
}
int main() {
ios :: sync_with_stdio(false);
cin.tie(0);
prework();
int T;
cin >> T;
while(T --) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 44ms
memory: 4720kb
input:
3 2 7 10
output:
0.693147180560 2.484906649788 3.401197381662
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 47ms
memory: 4668kb
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...
output:
59.808521922163 202.440525766049 204.287598873261 102.514787846767 12.794858810765 87.112177748175 94.289632957082 150.939424197891 135.931424622597 44.138273261701 130.234331136091 135.990701232526 171.942516156329 192.935006493194 67.651984757842 40.424701194997 116.701483268779 90.461792290901 15...
result:
ok 5000 numbers
Test #3:
score: 0
Accepted
time: 60ms
memory: 4860kb
input:
30000 14727 26896 6571 17234 3891 15888 13803 8818 11068 5541 24029 24764 15463 20613 8526 102 23759 10980 24923 19706 25043 2014 15199 19085 5761 24243 2075 16490 695 29219 2397 17193 25700 12082 13253 4167 5329 23855 6274 13900 26056 2910 28712 13016 9531 3368 17801 24668 23566 28589 1630 29223 24...
output:
391.313752946386 546.925107896460 248.614170741640 426.701267322129 183.873101749495 407.626707664900 377.464053061491 293.706970483076 333.305259996095 225.341292315153 514.109432127156 522.821621178336 401.575708654866 472.177929530877 288.029469559143 19.916245880689 510.958835143041 332.07204534...
result:
ok 30000 numbers
Test #4:
score: 0
Accepted
time: 59ms
memory: 4796kb
input:
30000 7303 9397 29807 14117 26079 521 24880 13348 3507 2730 12948 24124 11931 20353 2972 8842 2822 6482 28198 11160 20228 9360 22739 10345 6523 10943 1290 7656 25686 25672 5920 8709 21244 28654 14891 6931 13149 6285 25615 5220 26475 3569 4878 19879 17324 26596 20869 29746 22377 27326 10043 3099 1425...
output:
263.707192408788 303.923955038573 578.331860710564 381.789397771682 538.165663885402 56.296976483332 523.940241454194 369.898785750927 173.358138132544 150.444289903920 363.898210645922 515.495726488276 347.843999324018 468.086298284504 157.818963700939 294.368063637346 153.394117069082 246.30311196...
result:
ok 30000 numbers
Test #5:
score: 0
Accepted
time: 59ms
memory: 4860kb
input:
30000 20346 25684 25448 20568 28450 22513 24535 22174 27365 29390 29947 26968 24429 29299 22646 24327 20884 28665 28165 26338 24932 24668 26276 26758 20761 20643 22023 21015 25086 24814 29117 20105 23995 25805 24808 26211 23715 20272 24108 21876 25946 20128 26304 27341 21729 28712 28003 29471 24643 ...
output:
468.060926944762 533.040579836564 530.396179662539 471.319758384632 564.289074992852 496.066657631798 520.011206853513 492.144778782590 551.806012288188 574.273384134851 580.593077503067 548.063580534422 518.600782144315 573.531801950248 497.739232880503 517.510629508818 475.011142874933 566.4380336...
result:
ok 30000 numbers
Test #6:
score: 0
Accepted
time: 63ms
memory: 4700kb
input:
30000 29955 29983 29952 29905 29951 29929 29972 29954 29925 29932 29973 29965 29965 29963 29978 29914 29942 29906 29975 29901 29911 29952 29957 29903 29982 29982 29960 29917 29937 29915 29936 29976 29989 29900 29926 29923 29922 29976 29905 29995 29901 29952 29968 29954 29932 29971 29975 29936 29906 ...
output:
580.606810193386 580.657616209391 580.604222745305 579.938304590071 580.600307384929 580.563470077277 580.639499771885 580.606810193386 579.975498552406 580.566803413697 580.639499771885 580.624609658681 580.624609658681 580.620210728923 580.649433628410 579.956286447850 580.587040191985 579.9412986...
result:
ok 30000 numbers
Extra Test:
score: 0
Extra Test Passed