QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#370983 | #2771. Need for Speed | InfinityNS# | WA | 1ms | 4068kb | C++14 | 589b | 2024-03-29 20:37:10 | 2024-03-29 20:37:12 |
Judging History
answer
#include<bits/stdc++.h>
#define ld long double
using namespace std;
int main(){
int n,t;
scanf("%i %i",&n,&t);
ld l=-1e5,r=1e5;
vector<int> d(n),s(n);
int mn=INT_MAX;
for(int i=0;i<n;i++){
scanf("%i %i",&d[i],&s[i]);
mn=min(mn,s[i]);
}
l=-mn+1e-6;
for(int i=0;i<200;i++){
ld m=(l+r)/2;
ld tm=0;
for(int i=0;i<n;i++){
tm+=(ld)d[i]/(s[i]+m);
}
if(tm>t){
l=m;
}
else{
r=m;
}
}
printf("%.10Lf\n",l);
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3728kb
input:
3 5 4 -1 4 0 10 3
output:
3.0000000000
result:
ok found '3.0000000', expected '3.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
4 10 5 3 2 2 3 6 3 1
output:
-0.5086533768
result:
ok found '-0.5086534', expected '-0.5086534', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
1 500 123 456
output:
-455.7540000000
result:
ok found '-455.7540000', expected '-455.7540000', error '-0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 4068kb
input:
3 1 1 2 1 3 1 6
output:
-0.0000000000
result:
ok found '-0.0000000', expected '-0.0000000', error '-0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3776kb
input:
4 10 1 -1 2 -2 3 -3 4 -5
output:
5.4996199199
result:
ok found '5.4996199', expected '5.4996199', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
100 100001 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 10...
output:
-0.0000099999
result:
ok found '-0.0000100', expected '-0.0000100', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 4024kb
input:
100 99001 1000 999 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1...
output:
0.0000000101
result:
ok found '0.0000000', expected '0.0000000', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
1000 300 408 -17 943 -93 4 706 172 -343 472 -812 888 -669 507 -655 117 -324 209 -639 370 142 608 192 521 852 460 -269 93 56 821 -671 141 -240 190 574 608 79 681 295 742 123 954 91 194 -854 759 -807 639 593 901 147 877 740 492 216 498 985 884 -202 229 -982 261 -887 166 255 464 893 50 -63 664 -344 276...
output:
1838.0345693450
result:
ok found '1838.0345693', expected '1838.0345693', error '0.0000000'
Test #9:
score: -100
Wrong Answer
time: 1ms
memory: 4056kb
input:
1000 1 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1...
output:
100000.0000000000
result:
wrong answer 1st numbers differ - expected: '1001000.0000000', found: '100000.0000000', error = '0.9000999'