1011
来源:互联网 发布:交换机有mac地址吗 编辑:程序博客网 时间:2024/05/26 09:57
题意:
水!!!
分析 :
本来是水题一道,以为半个小时就能解决,可是,万万没想到啊,最后搞得泪流满面啊!!!
double a = 7.5;double b = 4.1;duoble p = a*b;
p得等于30.75吧
可是,竟然等于30.7499999999999!!!
欲哭无泪啊!!!
破double!!!
package AdvancedLevelPractice;import java.util.Scanner;public class pat1011 {public static void main(String[] args) {// TODO Auto-generated method stubScanner scanner = new Scanner(System.in);float bet1,bet2,sum = 1;int index;char ch = ' ';for(int i = 0; i < 3; i++){index = 0;bet1 = scanner.nextFloat();for(int j = 1; j < 3; j++ ){bet2 = scanner.nextFloat();if(bet2 > bet1){bet1 = bet2;index = j;}}switch(index){case 0:ch = 'W';break;case 1:ch = 'T';break;case 2:ch = 'L';break;}System.out.print(ch+" ");sum *= bet1;}double profit = (sum * 0.65 - 1) * 2;System.out.print(String.format("%.2f", profit));scanner.close();}}
0 0
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- [1011-
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- 1011
- IO流笔记4
- Android控件之ImageView
- xcode6中快捷键
- 1.Java NIO系列教程之概述
- unity学习之NGUI(二)
- 1011
- POJ 1384 完全背包
- Fibonacci Again
- 数据结构实验八——队列打印杨辉三角
- unity学习之NGUI(一)
- Running Python Programs from Emacs
- qplot()函数的详细用法
- 源码系列:红黑树
- 利用窗口分割将多EXE嵌入统一程序(MFC)