1 solutions
-
0
C :
#include<stdio.h> int main() { int n,d,count=0; while(scanf("%d%d",&n,&d)!=EOF,n||d) { int p,l,v; float sum=0,t=0; while(n--) { scanf("%d%d%d",&p,&l,&v); t+=l*2.0/v; sum+=l; } t=t+d-sum; count++; printf("Case %d: %.3f\n\n",count,t); } return 0; }C++ :
#include <stdio.h> int main() { int n, c = 0; double d, p, l, v, ans; while (scanf("%d%lf", &n, &d) != EOF, n || d) { ans = 0; while (n--) { scanf("%lf%lf%lf", &p, &l, &v); ans += 2.0 * l / v; d -= l; } printf("Case %d: %.3lf\n\n", ++c, d + ans); } return 0; }
- 1
Information
- ID
- 17348
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By