PAT甲级1011 World Cup Betting (20分)

PAT甲级1011 World Cup Betting (20分)

题目:在这里插入图片描述
题目分析:很简单,n2复杂度

AC代码:

#include <cstdio>
using namespace std;
int main() {
    
    
    char c[3] = {
    
    'W','T','L'};
    double ans = 1.0;
    for(int i = 0; i < 3; i++) {
    
    
        double maxvalue = 0.0;
        int maxchar = 0;
        for(int j = 0; j < 3; j++) {
    
    
            double temp;
            scanf("%lf", &temp);
            if(maxvalue <= temp) {
    
    
                maxvalue = temp;
                maxchar = j;
            }
        }
        ans *= maxvalue;
        printf("%c ", c[maxchar]);
    }
    printf("%.2f", (ans * 0.65 - 1) * 2);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43795683/article/details/104280784
今日推荐