码迷,mamicode.com
首页 > 其他好文 > 详细

赛码网-研究生考试

时间:2016-11-20 18:15:38      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:lin   input   数学   while   int   pre   考试   语言   时间   

研究生考试
 题目描述
									
欢迎大家参加奇虎360 2016校招在线招聘考试,首先预祝大家都有个好成绩!
我相信参加本次在线招聘考试的有不少研究生同学。我们知道,就计算机相关专业来说,考研有4门科目,分别是政治(满分100分),英语(满分100分),数学(满分150分)和专业课(满分150分)。
某校计算机专业今年录取研究生的要求是:政治、英语每门课成绩不低于60分,数学和专业课不低于90分,总成绩不低于310分。并且规定:在满足单科以及总成绩最低要求的基础上,350分以上(含350分)为公费(Gongfei),310分~349分为自费(Zifei)。
请编程判断考生的录取情况。


								
输入
输入数据首先包括一个正整数N,表示有N组测试数据。
每组数据包含4个正整数,分别表示考生的四门课成绩(顺序为:政治、英语、数学、专业课),你可以假设所有的分数数据都合法。
样例输入
3
61 62 100 120
80 80 120 100
55 90 130 130

输出
请输出每组数据对应考生的录取情况(Fail/Zifei/Gongfei)。

样例输出
Zifei
Gongfei
Fail
时间限制
C/C++语言:1000MS其它语言:3000MS	
内存限制
C/C++语言:65536KB其它语言:589824KB
package Main;

import java.util.Scanner;

public class Main6 {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		while (input.hasNext()) {
			int n = input.nextInt();
			int [] score = new int[4];
			for (int i = 0;i<n;i++) {
				for (int j = 0;j<score.length;j++) {
					score[j] = input.nextInt();
				}
				String result = solove(score);
				System.out.println(result);
			}
			
		}
		input.nextLine();
	}

	/**
	 * 处理函数
	 * @param score
	 * @return
	 */
	private static String solove(int[] score) {
		//对这个数组求和
		int sum = 0;
		for (int i = 0;i<score.length;i++) {
			sum += score[i];
		}
		String result = "";
		//前两个数据是政治英语
		if (score[0] <60 || score[1] < 60) {
			result = "Fail";
		} else if (score[2] <90 || score[3] < 90) {
			result = "Fail";
		} else if (sum < 310) {
			result = "Fail";
		} else if (sum >=350) {
			result = "Gongfei";
		} else if (sum >= 310 && sum<=349) {
			result = "Zifei";
		}
		
		return result;
	}
	
}

  

赛码网-研究生考试

标签:lin   input   数学   while   int   pre   考试   语言   时间   

原文地址:http://www.cnblogs.com/airycode/p/6082927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!