QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325133 | #5610. It's About Time | ape_pack | AC ✓ | 0ms | 3872kb | C++23 | 1.7kb | 2024-02-11 04:39:56 | 2024-02-11 04:39:56 |
Judging History
answer
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include<set>
#include<cstring>
using namespace std;
typedef long long ll;
int main(){
ll dist, speed, hours;
cin >> dist >> speed >> hours;
double days = (2*acos(-1)*dist)/(speed*hours);
double decimal = days - (long)days;
if(decimal > 0.5){
decimal = 1 - decimal;
}
double min_diff = 100000000;
double best_n1, best_n2, best_n3;
for(unsigned n1 = 1; n1 <= 1000; n1++){
for(unsigned n2 = 2*n1; n2 <= 1000; n2 += n1){
for(unsigned n3 = 2*n2; n3 <= 1000; n3 += n2){
double diff;
if(decimal < 0.5){
diff = (1/(double) n1) - (1/(double) n2) + (1/(double) n3);
}
// else {
// diff = -(1/(double) n1) + (1/(double) n2) - (1/(double) n3);
// }
// only add to a day when the difference is less than 0.5 otherwise you subtract from the day
if(n1 == 4 && n2 == 100 && n3 == 400){
// cout << "Value at right answer: " << diff << endl;
}
if(abs(decimal - diff) < min_diff){
// cout << "Found a better min diff: " << diff << " at " << n1 << " " << n2 << " " << n3 << endl;
min_diff = abs(decimal - diff);
best_n1 = n1; best_n2 = n2; best_n3 = n3;
}
}
}
}
cout << best_n1 << " " << best_n2 << " " << best_n3 << endl;
// cout << "DECIMAL: " << decimal << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3872kb
input:
92998938 66660 24
output:
4 100 400
result:
ok Output is valid!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
92998938 66660 25
output:
2 6 30
result:
ok Output is valid!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
1 1 1
output:
3 15 60
result:
ok Output is valid!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1000000000 1000000 1000
output:
3 15 60
result:
ok Output is valid!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1000000000 1 1
output:
5 45 540
result:
ok Output is valid!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
26373099 693335 239
output:
250 500 1000
result:
ok Output is valid!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
116691234 213569 246
output:
20 120 360
result:
ok Output is valid!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
50800597 848015 782
output:
2 50 750
result:
ok Output is valid!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
735896038 135114 659
output:
12 72 648
result:
ok Output is valid!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
366800924 611543 109
output:
2 10 40
result:
ok Output is valid!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
522294156 301860 432
output:
6 432 864
result:
ok Output is valid!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
408459747 702290 86
output:
2 114 684
result:
ok Output is valid!
Test #13:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
483269997 328697 800
output:
2 20 380
result:
ok Output is valid!
Test #14:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
10037736 216006 317
output:
12 180 900
result:
ok Output is valid!
Test #15:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
335021997 211213 76
output:
5 15 570
result:
ok Output is valid!
Test #16:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
628059082 935104 991
output:
2 4 120
result:
ok Output is valid!