1011. World Cup Betting (20)

简介: 简析:关键是W T L的对应。#include using namespace std;int main(int argc, const char * argv[]) { char c1 = '\0', c...

简析:关键是W T L的对应。

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    char c1 = '\0', c2 = '\0', c3 = '\0';
    double a, b, c;
    double t1 = 0, t2 = 0, t3 = 0;
    
    scanf("%lf%lf%lf", &a, &b, &c);
    if (a > b && a > c) { c1 = 'W'; t1 = a;}
    if (b > a && b > c) { c1 = 'T'; t1 = b;}
    if (c > a && c > b) { c1 = 'L'; t1 = c;}
    
    scanf("%lf%lf%lf", &a, &b, &c);
    if (a > b && a > c) { c2 = 'W'; t2 = a;}
    if (b > a && b > c) { c2 = 'T'; t2 = b;}
    if (c > a && c > b) { c2 = 'L'; t2 = c;}
    
    scanf("%lf%lf%lf", &a, &b, &c);
    if (a > b && a > c) { c3 = 'W'; t3 = a;}
    if (b > a && b > c) { c3 = 'T'; t3 = b;}
    if (c > a && c > b) { c3 = 'L'; t3 = c;}
    
    double sum = (t1 * t2 * t3 * 0.65 - 1) * 2;
    
    printf("%c %c %c %.2lf\n", c1, c2, c3, sum);
    
    return 0;
}


目录
相关文章
|
5月前
|
C++
C++之Hello,world
C++之Hello,world
World Final? World Cup (I)(模拟)
World Final? World Cup (I)(模拟)
77 0
01:Hello, World!
01:Hello, World!
94 0
【1011】World Cup Betting (20 分)
【1011】World Cup Betting (20 分) 【1011】World Cup Betting (20 分)
95 0
|
Java 设计模式 Android开发
虐心,Hello World
前言 无意中在知乎上看到了一个很有意思的回答:https://www.zhihu.com/question/277243683/answer/393676961题目是:如何把一段简单的代码变复杂? 答主的回答当然是为了调侃。
1404 0
1031. Hello World for U (20)
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U.
938 0