甲乙丙三人比赛 甲花的时间为t1,强度为s1,乙花的时间为t2,强度为s2,丙花的时间为t3,强度为s3,花的时间最少获胜,注意当他们花的时间一样的情况下就用强度进行比较,强度越大越好,用c语言写出来
时间: 2024-05-22 09:12:39 浏览: 9
#include <stdio.h>
int main() {
int t1, s1, t2, s2, t3, s3;
scanf("%d %d %d %d %d %d", &t1, &s1, &t2, &s2, &t3, &s3);
if (t1 < t2 && t1 < t3) {
printf("甲获胜");
} else if (t2 < t1 && t2 < t3) {
printf("乙获胜");
} else if (t3 < t1 && t3 < t2) {
printf("丙获胜");
} else if (t1 == t2 && t1 < t3) {
if (s1 > s2) {
printf("甲获胜");
} else {
printf("乙获胜");
}
} else if (t1 == t3 && t1 < t2) {
if (s1 > s3) {
printf("甲获胜");
} else {
printf("丙获胜");
}
} else if (t2 == t3 && t2 < t1) {
if (s2 > s3) {
printf("乙获胜");
} else {
printf("丙获胜");
}
} else { // t1 == t2 == t3
if (s1 > s2 && s1 > s3) {
printf("甲获胜");
} else if (s2 > s1 && s2 > s3) {
printf("乙获胜");
} else {
printf("丙获胜");
}
}
return 0;
}
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)