Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## tips

Posted by ragnarok01 at 2013-10-06 22:22:55 on Problem 3296 and last updated at 2013-10-06 22:24:16
```这题原始出处已经失效了，不过还好题目有备份：https://code.google.com/p/freeproblemset/downloads/list

（1） vb + vw < vr  要求直接输出单一个0；
（2） 不满足（1）但 vb==0 ，则输出k个0。

#include<cstdio>

int main() {
double vb, vw, vr, vc;
int k, i;
while(1) {
scanf("%d %lf %lf %lf %lf", &k, &vb, &vw, &vr, &vc);
if(k == 0) break;
if(vb + vw < vr)
{
puts("0");
continue;
}
double f = (vb+(k-1)*vr-(k-1)*vw)/k;
if(f<0) f = 0;
double leftover = vb-(k-1)*(vc-vr);
if(f<leftover) f = leftover;
if(f+vw>vc) f = vc-vw;
if(f>vb) f= vb;
double s = 0;
if(k>1) {
s = (vb-f)/(k-1);
if(vr+s > vc) s=vc-vr;
}
printf("%d %.2f", k, f);
for(i = 0; i < k-1; i++) {
printf(" %.2f", s);
}
printf("\n");
}
return 0;
}

2 15.0 25.0 1.0 50.0
3 15.0 8.0 3.0 10.0
3 14.0 8.0 3.0 10.0
3 30.0 25.0 1.0 50.0
3 30.0 5.0 1.0 50.0
3 0 5.0 1.0 50.0
3 0.2 0.5 1.0 50.0
3 200 0.5 1.0 50.0
0

2 0.00 15.00
3 1.67 6.67 6.67
3 1.33 6.33 6.33
3 0.00 15.00 15.00
3 7.33 11.33 11.33
3 0.00 0.00 0.00
0
3 49.50 49.00 49.00

Followed by: