QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325342 | #5610. It's About Time | aggrovector# | AC ✓ | 1ms | 3816kb | C++14 | 2.3kb | 2024-02-11 08:25:48 | 2024-02-11 08:25:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> p64;
typedef vector<ll> v64;
typedef vector<v64> vv64;
typedef vector<p64> vp64;
#define PI 3.141592653589793238462643383279502884L
ll r, s, h;
std::map<v64, ld> err;
ld getErr(ld rem, v64 v) {
return abs(rem - (1.0L/v[0]) + (1.0L/v[0]/v[1]) - (1.0L/v[0]/v[1]/v[2]));
}
void rec1(ld rem, ld range, v64 v);
void rec2(ld rem, ld range, v64 v);
void rec3(ld rem, ld range, v64 v);
void rec1(ld rem, ld range, v64 v) {
// cout << "rem1: " << rem << endl;
for (ll i=2; i<=1000/4; i++) {
if (range/i > rem) {
v[0] = i;
ld nrem = (range/i) - rem;
ld nrange = (range/i);
rec2(nrem, nrange, v);
} else {
v[0] = i;
v[1] = 1000L / (2*v[0]);
v[2] = 2;
err[v] = abs(rem - (1.0L/v[0]) + (1.0L/v[0]/v[1]) - (1.0L/v[0]/v[1]/v[2]));
return;
}
}
}
void rec2(ld rem, ld range, v64 v) {
// cout << "rem2: " << rem << endl;
for (ll i=2; i<=1000/(2*v[0]); i++) {
if (range/i > rem) {
v[1] = i;
ld nrem = (range/i) - rem;
ld nrange = (range/i);
rec3(nrem, nrange, v);
} else {
v[1] = i;
v[2] = 1000L / (v[0]*v[1]);
err[v] = abs(rem - (1.0L/v[0]/v[1]) + (1.0L/v[0]/v[1]/v[2]));
return;
}
}
}
void rec3(ld rem, ld range, v64 v) {
// cout << "rem3: " << rem << endl;
ll maxi = 1000 / (v[0]*v[1]);
if (range > maxi * rem) {
v[2] = maxi;
err[v] = abs(rem - (range / maxi));
} else {
v[2] = (ll)(range/rem);
err[v] = abs(rem - (range / v[2]));
v[2]++;
err[v] = abs(rem - (range / v[2]));
}
}
int main () {
cin >> r >> s >> h;
ld rem = 2.0L*PI*r / s / h;
rem = rem - (ll)rem;
if (rem > 0.5L) {
rem = 1.0L-rem;
}
rec1(rem - (ll)rem, 1.0L, {0, 0, 0});
v64 pattern = {0, 0, 0};
ld minErr = 1.0;
for (auto entry : err) {
// cout << entry.second << endl;
if (entry.second < minErr) {
minErr = entry.second;
pattern = entry.first;
}
}
cout << pattern[0] << " " << pattern[0]*pattern[1] << " " << pattern[0]*pattern[1]*pattern[2] << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
92998938 66660 24
output:
4 100 400
result:
ok Output is valid!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
92998938 66660 25
output:
2 6 30
result:
ok Output is valid!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
1 1 1
output:
3 15 60
result:
ok Output is valid!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
1000000000 1000000 1000
output:
3 15 60
result:
ok Output is valid!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
1000000000 1 1
output:
5 45 540
result:
ok Output is valid!
Test #6:
score: 0
Accepted
time: 1ms
memory: 3788kb
input:
26373099 693335 239
output:
250 500 1000
result:
ok Output is valid!
Test #7:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
116691234 213569 246
output:
15 30 90
result:
ok Output is valid!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
50800597 848015 782
output:
2 50 750
result:
ok Output is valid!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
735896038 135114 659
output:
12 72 648
result:
ok Output is valid!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
366800924 611543 109
output:
2 10 40
result:
ok Output is valid!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
522294156 301860 432
output:
6 432 864
result:
ok Output is valid!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
408459747 702290 86
output:
2 114 684
result:
ok Output is valid!
Test #13:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
483269997 328697 800
output:
2 20 380
result:
ok Output is valid!
Test #14:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
10037736 216006 317
output:
12 180 900
result:
ok Output is valid!
Test #15:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
335021997 211213 76
output:
6 30 570
result:
ok Output is valid!
Test #16:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
628059082 935104 991
output:
3 12 120
result:
ok Output is valid!