PAT(上級レベル)1011年ワールドカップベッティング(20ポイント)Javaソリューション

ここに画像を挿入説明
時間は掛け
奇数偶数
奇数奇数割り当て割り当て
最寄りの10進数小数点以下2桁の精度アップ2

サンプル入力:

1.1 2.5 1.7
1.2 3.1 1.6
4.1 1.2 1.1

サンプル出力:

TTW 39.31

package PAT_Advanced_Level;

import java.text.DecimalFormat;

import java.util.Scanner;

public class _1011_World_Cup_Betting {
	static double ans = 1;
	static String s = "";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for (int i = 0; i < 3; i++) {
			int n = 3;
			double max = Double.MIN_VALUE;
			String sym = null;
			while (n-- > 0) {
				double temp = sc.nextDouble();
				if (temp > max && n == 2) {
					max = temp;
					sym = "W";
				} else if (temp > max && n == 1) {
					max = temp;
					sym = "T";
				} else if (temp > max && n == 0) {
					max = temp;
					sym = "L";
				}

			}
			s += sym + " ";
			ans *= max;

		}
		ans *= 0.65;
		double fina = (ans - 1) * 2;
		DecimalFormat df = new DecimalFormat("#.00");
		System.out.print(s);
		System.out.print(df.format(fina));

	}

}

ここに画像を挿入説明

公開された83元の記事 ウォンの賞賛1 ビュー1017

おすすめ

転載: blog.csdn.net/qq_44028719/article/details/103993952