# 360公司2016校园招聘笔试题大题一

## 代码

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

public class Main {

static char[][] numbers = {
{' ', ' ','-',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' ', ' ','-',' ', ' ','-',' ', ' ','-',' '},
{' ', '|',' ','|', ' ','|',' ', ' ',' ','|', ' ',' ','|', '|',' ','|', '|',' ',' ', '|',' ',' ', ' ',' ','|', '|',' ','|', '|',' ','|'},
{'*', ' ',' ',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' ', ' ','-',' ', ' ','-',' ', ' ','-',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' '},
{' ', '|',' ','|', ' ','|',' ', '|',' ',' ', ' ',' ','|', ' ',' ','|', ' ',' ','|', '|',' ','|', ' ',' ','|', '|',' ','|', ' ',' ','|'},
{' ', ' ','-',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' ', ' ',' ',' ', ' ','-',' ', ' ','-',' '}};

public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
while(cin.hasNextInt()){
int k = cin.nextInt();
printNum(getYinshu(k));
}
}

public static void printNum(List<Integer> nums){
int k = nums.size() - 1;
if(k==0){
printPrime(nums.get(0));
return;
}
for (int i = 0; i < 5; i++) {
for(int m = 0;m<nums.size()-1;m++){
int orin = nums.get(m);
int n = Math.abs(orin);
for (int j = 3 * n + 1; j < 3 * (n + 1) + 1; j++) {
System.out.print(numbers[i][j]);
}
if(orin>0){//超过9的质数
if(i==2){
System.out.print('*');
}
else{
System.out.print(' ');
}
}
}
int n = nums.get(k);
for (int j = 3 * n + 1; j < 3 * (n + 1) + 1; j++) {
System.out.print(numbers[i][j]);
}
System.out.println();
}
}

public static void printPrime(List<Integer> nums){
int k = nums.size() - 1;
if(k==0){
printPrime(nums.get(0));
return;
}
for (int i = 0; i < 5; i++) {
for(int m = 0;m<nums.size();m++){
int n = nums.get(m);
for (int j = 3 * n + 1; j < 3 * (n + 1) + 1; j++) {
System.out.print(numbers[i][j]);
}
}
System.out.println();
}
}

public static void printPrime(int num){
String str = String.valueOf(num);
char c;
int n;
List<Integer> result = new ArrayList<Integer>();
for(int i=0;i<str.length();i++){
c = str.charAt(i);
n = Integer.valueOf(String.valueOf(c));
}
printPrime(result);
}

public static List<Integer> getYinshu(int num){
List<Integer> result = new ArrayList<Integer>();
int prime = 2;
while (prime <= num) {
if (prime == num) {
if(num>9){
//超过9，进行分割
String str = String.valueOf(num);
char c;
int n;
for(int i=0;i<str.length()-1;i++){
c = str.charAt(i);
n = Integer.valueOf(String.valueOf(c));
}
c = str.charAt(str.length()-1);
n = Integer.valueOf(String.valueOf(c));
}
else{
}
break;
} else if (num % prime == 0) {
if(prime>9){
//超过9，进行分割
String str = String.valueOf(prime);
char c;
int n;
for(int i=0;i<str.length()-1;i++){
c = str.charAt(i);
n = Integer.valueOf(String.valueOf(c));
}
c = str.charAt(str.length()-1);
n = Integer.valueOf(String.valueOf(c));
}
else{
}
num = num / prime;
} else {
prime++;
}
}
return result;
}
}

08-27 943

08-12 830
08-16 609
09-17 979
08-28 2288
09-17 4578
08-28 659
09-20 1782
03-31 6939
08-10 562
09-17 1082
08-12 335
09-07 256
09-20 1173
09-09 577
07-08 557