L1-7 装睡 (10分)

你永远叫不醒一个装睡的人 —— 但是通过分析一个人的呼吸频率和脉搏,你可以发现谁在装睡!医生告诉我们,正常人睡眠时的呼吸频率是每分钟15-20次,脉搏是每分钟50-70次。下面给定一系列人的呼吸频率与脉搏,请你找出他们中间有可能在装睡的人,即至少一项指标不在正常范围内的人。

输入格式:

输入在第一行给出一个正整数NNN≤10\le 1010)。随后NNN行,每行给出一个人的名字(仅由英文字母组成的、长度不超过3个字符的串)、其呼吸频率和脉搏(均为不超过100的正整数)。

输出格式:

按照输入顺序检查每个人,如果其至少一项指标不在正常范围内,则输出其名字,每个名字占一行。

输入样例:

4
Amy 15 70
Tom 14 60
Joe 18 50
Zoe 21 71

    
    

输出样例:

Tom
Zoe

    
    
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
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 n = Reader.nextInt();
		for (int i = 0; i < n; i++) {
			String name = Reader.next();
			int a = Reader.nextInt();
			int b = Reader.nextInt();
			if (a<15||a>20||b<50||b>70) {
				System.out.println(name);
			}
		}
	}
}



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

猜你喜欢

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