360校园招聘2016笔试题
来源:互联网 发布:mac魔兽大脚插件 编辑:程序博客网 时间:2024/04/30 01:14
40选择题,2道编程题。
1. 第一道编程很简单,根据研究生的四门课入学成绩判断,Fail或Gongfei,Zifei。
import java.util.Scanner;/** * Created by aifei on 15/9/15. */public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while(n-->0){ int []score = new int[4]; for(int i = 0;i<4;i++){ score[i] = sc.nextInt(); } int sum = score[0] + score[1] + score[2] + score[3]; if(!isFail(score,sum)){ System.out.println("Fail"); }else{ if(sum>=310 && sum<=349){ System.out.println("Zifei"); }else{ System.out.println("Gongfei"); } } } } private static boolean isFail(int[] score,int sum) { if(score[0]>=60 && score[1]>=60 && score[2]>=90 && score[3]>=90 && sum>=310){ return true; }else { return false; } }}
2. 素因子分解,并以可视化数字输出素因子。
import java.util.ArrayList;import java.util.Scanner;/** * Created by on 15/9/15. */public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); ArrayList<Integer> list = new ArrayList<Integer>(); int key = 1; while(n > 1){ for(int i=2; i<=n;i++){ if(n%i==0){ key = i; list.add(key); break; } } n = n/key; } for(int i=0; i<list.size();i++){ if(i!=list.size()-1){ visualOutPut(list.get(i)); System.out.print("*"); }else{ visualOutPut(list.get(i)); } } } } private static void visualOutPut(int num) { String str = String.valueOf(num); for(int i=0; i<str.length();i++){ char ch = str.charAt(i); visualDigit(ch); } } private static void visualDigit(char ch) { switch (ch){ case '0': System.out.println(" "+'-'); System.out.print("|"); System.out.println(" "+"|"); System.out.println(" "+'-'); System.out.print("|"); System.out.println(" "+"|"); System.out.print(" "+'-'); break; case '1': System.out.println("|"); System.out.println('|'); break; case '2': System.out.println(" "+'-'); System.out.println(" "+"|"); System.out.println(" "+'-'); System.out.println('|'); System.out.println(" "+'-'); break; case '5': System.out.println(" "+'-'); System.out.println("|"); System.out.println(" "+'-'); System.out.println(" "+'|'); System.out.print(" "+'-'); break; } }}
0 0
- 360校园招聘2016笔试题
- 360校园招聘笔试题
- 校园招聘笔试题
- 360公司 2016校园招聘在线笔试编程题
- 360公司2016校园招聘笔试题大题一
- 360公司2016校园招聘笔试题大题一
- 华为2016校园招聘上机笔试题
- 华为2016校园招聘笔试题
- 2016校园招聘笔试编程题_1
- 京东2016校园招聘笔试题
- 携程2016校园招聘笔试题分析
- 华为2016校园招聘上机笔试题
- 华为2016校园招聘上机笔试题
- 华为2016校园招聘上机笔试题
- 华为2016校园招聘上机笔试题
- sybase2009校园招聘笔试题
- 淘宝校园招聘笔试题
- 微软校园招聘笔试题
- Hibernate EhCache configuration tutorial
- hdoj 2842 Chinese Rings 【递推 + 矩阵快速幂】
- Android手机的休眠状态
- 浅谈Java的==、equals()、hashcode()
- Hadoop(六)——子项目Pig
- 360校园招聘2016笔试题
- 配置vim编写C/C++程序时自动缩进
- POJ - 2236 Wireless Network(并查集)
- BOSH、长连接和短连接、http的理解
- URLClassLoader使用方法和实例
- 面试——计算机网络专项练习题(一)
- HTML5部分新增标签
- POJ水题集1
- 【图论】DAG上的相关问题