题目是不难的, 就是考验读题能力, 太瘦 | 标准身材 | 太胖, 花了很大的经历来读题目, 还是写题目写得太少了, 都写点题目, 就顺了. 代码如下:
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]); } } }