QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325213 | #5610. It's About Time | tom0727 | WA | 1ms | 3852kb | C++20 | 1.1kb | 2024-02-11 05:50:51 | 2024-02-11 05:50:52 |
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 = 3.1415926535;
int r, s, h, d, a3, a2, a1;
double y, l, f, est, L, mn = 1e9;
void check_n1(int n3, int n2, int n1) {
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 (n3==400 && n2==100 && n1==4) {
// 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("%d%d%d",&r,&s,&h);
l = 2*pi*r;
y = l / s / h;
d = round(y);
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("%d %d %d\n", a1, a2 ,a3);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3720kb
input:
92998938 66660 24
output:
4 100 400
result:
ok Output is valid!
Test #2:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
92998938 66660 25
output:
2 6 30
result:
ok Output is valid!
Test #3:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
1 1 1
output:
3 15 60
result:
ok Output is valid!
Test #4:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
1000000000 1000000 1000
output:
3 15 60
result:
ok Output is valid!
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3724kb
input:
1000000000 1 1
output:
0 0 0
result:
wrong answer Integer parameter [name=n1] equals to 0, violates the range [1, 1000]