7-5 是不是太胖了 (5分)

据说一个人的标准体重应该是其身高(单位:厘米)减去100、再乘以0.9所得到的公斤数。已知市斤的数值是公斤数值的两倍。现给定某人身高,请你计算其标准体重应该是多少?(顺便也悄悄给自己算一下吧……)

输入格式:
输入第一行给出一个正整数H(100 < H ≤ 300),为某人身高。

输出格式:
在一行中输出对应的标准体重,单位为市斤,保留小数点后1位。

输入样例:
169

输出样例:
124.2

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

//** Class for buffered reading int and double values *//*
class Reader {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	// ** call this method to initialize reader for InputStream *//*
	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	// ** get next word *//*
	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			// TODO add check for eof if necessary
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
	static boolean hasNext()throws IOException {
		return tokenizer.hasMoreTokens();
	}
	static String nextLine() throws IOException{
		return reader.readLine();
	}
	static char nextChar() throws IOException{
		return next().charAt(0);
	}
	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static float nextFloat() throws IOException {
		return Float.parseFloat(next());
	}
}
public class Main {
	public static void main(String[] args) throws IOException {
		Reader.init(System.in);
		int h = Reader.nextInt();
		
		System.out.println(String.format("%.1f", (h-100)*0.9*2));
	}
}



发布了45 篇原创文章 · 获赞 8 · 访问量 1782

猜你喜欢

转载自blog.csdn.net/weixin_43888039/article/details/104009409