L1-031 到底是不是太胖了
据说一个人的标准体重应该是其身高(单位:厘米)减去 100、再乘以 0.9 所得到的公斤数。真实体重与标准体重误差在 10%以内都是完美身材(即 | 真实体重 − 标准体重 | < 标准体重 ×10%)。已知市斤是公斤的两倍。现给定一群人的身高和实际体重,请你告诉他们是否太胖或太瘦了。
输入格式:
输入第一行给出一个正整数N
(≤ 20)。随后N
行,每行给出两个整数,分别是一个人的身高H
(120 < H
< 200;单位:厘米)和真实体重W
(50 < W
≤ 300;单位:市斤),其间以空格分隔。
输出格式:
为每个人输出一行结论:如果是完美身材,输出You are wan mei!
;如果太胖了,输出You are tai pang le!
;否则输出You are tai shou le!
。
输入样例:
tex
3
169 136
150 81
178 155
3
169 136
150 81
178 155
输出样例:
tex
You are wan mei!
You are tai shou le!
You are tai pang le!
You are wan mei!
You are tai shou le!
You are tai pang le!
Solution:
java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = parseInt(in.readLine());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
String[] input = in.readLine().split(" ");
int h = parseInt(input[0]);
int w = parseInt(input[1]);
if (i > 0) sb.append("\n");
double normal = (h - 100) * 1.8;
if (Math.abs(w - normal) < normal * 0.1) sb.append("You are wan mei!");
else if (w < normal) sb.append("You are tai shou le!");
else if (w > normal) sb.append("You are tai pang le!");
}
System.out.println(sb);
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = parseInt(in.readLine());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
String[] input = in.readLine().split(" ");
int h = parseInt(input[0]);
int w = parseInt(input[1]);
if (i > 0) sb.append("\n");
double normal = (h - 100) * 1.8;
if (Math.abs(w - normal) < normal * 0.1) sb.append("You are wan mei!");
else if (w < normal) sb.append("You are tai shou le!");
else if (w > normal) sb.append("You are tai pang le!");
}
System.out.println(sb);
}
}