-
Notifications
You must be signed in to change notification settings - Fork 0
/
1065.c
83 lines (74 loc) · 1.53 KB
/
1065.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// 逻辑没问题,输入数据后,输出与样例不一致
/*
样例输入
4 1.0
1.0 2.0 3.0 4.0
4.0 3.0 2.0 1.0
1 1.0
2 1.0
3 1.0
4 1.0
样例输出
D
2.23
样例输入
4 1.0
1.0 2.0 3.0 4.0
4.0 3.0 2.0 1.0
1 2.0
2 1.0
3 2.0
4 1.0
样例输出
R
3.19
*/
# include <stdio.h>
int main(int argc, char const *argv[]) {
int n;
float T;
float vt1, vt2, vt3, vt4;
float vr1, vr2, vr3, vr4;
int Ti;
float Tts, Trs; // 分段时间, 总时间
float Li; // 分段路程, 总路程
int i;
Tts = Trs = 0;
scanf ("%d %f", &n, &T);
scanf ("%f %f %f %f", &vt1, &vt2, &vt3, &vt4);
scanf ("%f %f %f %f", &vr1, &vr2, &vr3, &vr4);
for (i = 0; i < n; i++) {
scanf ("%d %f", &Ti, &Li); // 场地类型, 长度
switch (Ti) {
printf("%d\n", Ti);
case 1:
Tts += (Li / vt1);
Trs += (Li / vr1);
break;
case 2:
Tts += Li / vt2;
Trs += Li / vr2;
break;
case 3:
Tts += Li / vt3;
Trs += Li / vr3;
break;
case 4:
Tts += Li / vt4;
Trs += Li / vr4;
break;
}
printf("%f %f\n", Tts, Trs);
}
if (Trs < Tts) {
printf("R\n");
printf("%.2f\n", Tts);
} else if (Trs > Tts){
printf("T\n");
printf("%.2f\n", Trs);
} else {
printf("D\n");
printf("%.2f\n", Tts);
}
return 0;
}