L1-063 吃鱼还是吃肉 - java

题目解析

判断给定身高 体重 各 怎么样

解题思路

判断输出即可…

代码

import java.io.*;
import java.math.*;
import java.util.*;

public class Main
{

	public static void main(String[] args)
	{
		int n = sc.nextInt();
		while (n-- > 0)
		{
			int op = sc.nextInt();
			int h = sc.nextInt();
			int w = sc.nextInt();

			if ((op == 1 && h > 130) || (op == 0 && h > 129))
				out.print("ni li hai! ");
			else if ((op == 1 && h == 130) || (op == 0 && h == 129))
				out.print("wan mei! ");
			else
				out.print("duo chi yu! ");

			if ((op == 1 && w > 27) || (op == 0 && w > 25))
				out.println("shao chi rou!");
			else if ((op == 1 && w == 27) || (op == 0 && w == 25))
				out.println("wan mei!");
			else
				out.println("duo chi rou!");

		}

		out.flush();
		out.close();
	}

	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
}


团体程序设计天梯赛-练习集-java

赞赏