2018/12/06 L1-031 到底是不是太胖了 Java

题目是不难的, 就是考验读题能力, 太瘦 | 标准身材 | 太胖, 花了很大的经历来读题目, 还是写题目写得太少了, 都写点题目, 就顺了. 代码如下:

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int num = Integer.parseInt(br.readLine());
        String[] str = new String[2];
        String[] outPutString = new String[num];
        int height = 0;
        int weight = 0;
        double greatWeight = 0;
        for(int i =0; i<num; i++) {
            str = br.readLine().split(" ");
            height = Integer.parseInt(str[0]);
            weight = Integer.parseInt(str[1]);
            greatWeight = ((double)height - 100)*0.9*2;
            if( (Math.abs(weight - greatWeight)) < greatWeight*0.1){
                outPutString[i] = "You are wan mei!";
            } else if ((greatWeight - weight) >= greatWeight*0.1) {
                outPutString[i] = "You are tai shou le!";
            } else if ((weight - greatWeight) >= greatWeight*0.1){
                outPutString[i] = "You are tai pang le!";
            }

        }
        
        for(int i=0; i<num; i++) {
            System.out.println(outPutString[i]);
        }
        
    }

}

 

转载于:https://www.cnblogs.com/huangZ-H/p/10079981.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值