mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-27 02:25:37 +00:00
53 lines
973 B
C
53 lines
973 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int type;
|
|
double s1, s2, s3;
|
|
|
|
scanf("%d%lf%lf%lf", &type, &s1, &s2, &s3);
|
|
|
|
if (type == 0) { // 赛跑,从低到高排序
|
|
if (s1 > s2) {
|
|
double temp = s1;
|
|
s1 = s2;
|
|
s2 = temp;
|
|
}
|
|
|
|
if (s1 > s3) {
|
|
double temp = s1;
|
|
s1 = s3;
|
|
s3 = temp;
|
|
}
|
|
|
|
if (s2 > s3) {
|
|
double temp = s2;
|
|
s2 = s3;
|
|
s3 = temp;
|
|
}
|
|
|
|
printf("%.2lf %.2lf %.2lf\n", s1, s2, s3);
|
|
} else { // type == 1
|
|
if (s1 < s2) {
|
|
double temp = s1;
|
|
s1 = s2;
|
|
s2 = temp;
|
|
}
|
|
|
|
if (s1 < s3) {
|
|
double temp = s1;
|
|
s1 = s3;
|
|
s3 = temp;
|
|
}
|
|
|
|
if (s2 < s3) {
|
|
double temp = s2;
|
|
s2 = s3;
|
|
s3 = temp;
|
|
}
|
|
|
|
printf("%.2lf %.2lf %.2lf\n", s1, s2, s3);
|
|
}
|
|
|
|
return 0;
|
|
}
|