QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325232 | #5610. It's About Time | tom0727 | AC ✓ | 1ms | 3912kb | C++20 | 1.2kb | 2024-02-11 06:07:57 | 2024-02-11 06:07:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef pair<int, int> pii;
const int maxn = 111;
const double pi = atan2(0, -1);
long long r, s, h, d, a3, a2, a1;
double y, l, f, est, L, mn = 1e9;
void check_n1(int n3, int n2, int n1, int debug=false) {
f = fabs(n3 * (y-d));
est = n3/n1 - n3/n2 + 1;
L = fabs(f - est) / n3;
if (L<mn) {
mn = L;
a3 = n3;
a2 = n2;
a1 = n1;
}
if (debug) {
printf("y=%lf, d=%d, f=%lf, est=%lf, L=%lf, mn=%lf\n", y, d, f, est, L, mn);
}
}
void check_n2(int n3, int n2) {
for (int n1=2;n1*n1<=n2;n1++)
if (n2%n1==0) {
check_n1(n3, n2, n1);
if (n1*n1!=n2)
check_n1(n3, n2, n2/n1);
}
}
int main() {
scanf("%lld%lld%lld",&r,&s,&h);
l = 2*pi*r;
y = l / s / h;
// y = 365;
d = round(y);
// printf("%lf\n", pi);
for (int n3=4;n3<=1000;n3++) {
for (int n2=2;n2*n2<=n3;n2++)
if (n3%n2==0) {
check_n2(n3, n2);
if (n2*n2!=n3) check_n2(n3, n3/n2);
}
}
// printf("%lf\n", mn);
printf("%lld %lld %lld\n", a1, a2 ,a3);
// check_n1(a3, a2, a1, true);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3756kb
input:
92998938 66660 24
output:
4 100 400
result:
ok Output is valid!
Test #2:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
92998938 66660 25
output:
2 6 30
result:
ok Output is valid!
Test #3:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
1 1 1
output:
3 15 60
result:
ok Output is valid!
Test #4:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
1000000000 1000000 1000
output:
3 15 60
result:
ok Output is valid!
Test #5:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
1000000000 1 1
output:
5 45 540
result:
ok Output is valid!
Test #6:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
26373099 693335 239
output:
250 500 1000
result:
ok Output is valid!
Test #7:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
116691234 213569 246
output:
15 30 90
result:
ok Output is valid!
Test #8:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
50800597 848015 782
output:
2 50 750
result:
ok Output is valid!
Test #9:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
735896038 135114 659
output:
12 72 648
result:
ok Output is valid!
Test #10:
score: 0
Accepted
time: 1ms
memory: 3776kb
input:
366800924 611543 109
output:
2 12 120
result:
ok Output is valid!
Test #11:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
522294156 301860 432
output:
6 432 864
result:
ok Output is valid!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
408459747 702290 86
output:
2 114 684
result:
ok Output is valid!
Test #13:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
483269997 328697 800
output:
2 20 380
result:
ok Output is valid!
Test #14:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
10037736 216006 317
output:
12 180 900
result:
ok Output is valid!
Test #15:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
335021997 211213 76
output:
5 15 570
result:
ok Output is valid!
Test #16:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
628059082 935104 991
output:
2 4 120
result:
ok Output is valid!