Smile9870

1011. World Cup Betting (20)

生词(在文中的意思)

tie 平局  lay a bet 打赌  putting their money where their mouths were 把他们的钱用在刀刃上  manner of 的方式

odds 胜算  corresponding 对应的

这里有一个小问题要说一下,以下程序在自己电脑上运行样例显示结果为37.97,但提交正确。也许是运行环境不同。c++也有同样问题,可以参考此贴赵老师的回答。

http://bbs.csdn.net/topics/390486879

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        double[][] a = new double[3][3];
        Scanner sc = new Scanner(System.in);
        double[] max = new double[3];
        double result = 1;
        int[] pos = new int[3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                a[i][j] = sc.nextDouble();
                if (a[i][j] > max[i]) {
                    max[i] = a[i][j];
                    pos[i] = j;
                }
            }
            if (pos[i] == 0) {
                System.out.print("W ");
            }
            if (pos[i] == 1) {
                System.out.print("T ");
            }
            if (pos[i] == 2) {
                System.out.print("L ");
            }
            result *= max[i];
        }
        result = (result * 0.65 - 1) * 2;
        System.out.printf("%.2f", result);

    }

}

 

posted on 2018-01-03 20:44  Smile9870  阅读(133)  评论(0编辑  收藏  举报

导航