关注
//线上AC了
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static final char[][] number_0={{' ','-','
'},{'|',' ','|'},{' ',' ',' '},{'|',' ','|'},{' ','-',' '}};
public static final char[][] number_1={{' ',' ',' '},{'
',' ','|'},{' ',' ',' '},{' ',' ','|'},{' ',' ',' '}};
public static final char[][] number_2={{' ','-',' '},{' ','
','|'},{' ','-',' '},{'|',' ',' '},{' ','-',' '}};
public static final char[][] number_3={{' ','-',' '},{' ','
','|'},{' ','-',' '},{' ',' ','|'},{' ','-',' '}};
public static final char[][] number_4={{' ',' ',' '},{'|','
','|'},{' ','-',' '},{' ',' ','|'},{' ',' ',' '}};
public static final char[][] number_5={{' ','-',' '},{'|','
',' '},{' ','-',' '},{' ',' ','|'},{' ','-',' '}};
public static final char[][] number_6={{' ','-',' '},{'|','
',' '},{' ','-',' '},{'|',' ','|'},{' ','-',' '}};
public static final char[][] number_7={{' ','-',' '},{' ','
','|'},{' ',' ',' '},{' ',' ','|'},{' ',' ',' '}};
public static final char[][] number_8={{' ','-',' '},{'|','
','|'},{' ','-',' '},{'|',' ','|'},{' ','-',' '}};
public static final char[][] number_9={{' ','-',' '},{'|','
','|'},{' ','-',' '},{' ',' ','|'},{' ','-',' '}};
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
//输入数据组数
while(cin.hasNext()){
//输入的数据
int n = cin.nextInt();
//需要打印的结果
ArrayList<Integer> result = new
ArrayList<Integer>();
while(true){
if(n < 2) break;
boolean flag = false;
for(int j = 2; j <= n; j++){
if(n % j == 0){
result.add(j);
flag = true;
n = n / j;
break;
}
}
if(!flag) break;
}
printResult(result);
if(cin.hasNext())
System.out.println();
}
}
public static void printResult(ArrayList<Integer>
list){
ArrayList<ArrayList<Character>> result = new
ArrayList<ArrayList<Character>>();
for(int i = 0; i < 5; i++){
result.add(new ArrayList<Character>());
}
for(int i = 0; i< list.size(); i++){
int number = list.get(i);
String StringInt= String.valueOf(number);
for(int j = 0; j < StringInt.length();j++){
char fch=StringInt.charAt(j);
//{' ','-',' '},{'|',' ','|'},{' ',' ',' '},{'|','
','|'},{' ','-',' '}
if(fch == '0'){
add(result,number_0);
}else if(fch == '1'){
add(result,number_1);
}else if(fch == '2'){
add(result,number_2);
}else if(fch == '3'){
add(result,number_3);
}else if(fch == '4'){
add(result,number_4);
}else if(fch == '5'){
add(result,number_5);
}else if(fch == '6'){
add(result,number_6);
}else if(fch == '7'){
add(result,number_7);
}else if(fch == '8'){
add(result,number_8);
}else if(fch == '9'){
add(result,number_9);
}
}
result.get(0).add(' ');
result.get(1).add(' ');
result.get(2).add('*');
result.get(3).add(' ');
result.get(4).add(' ');
}
for(int i = 0; i < 5; i++){
result.get(i).remove(result.get(i).size() -1);
for(Character c : result.get(i)){
System.out.print(c);
}
if(i != 4)
System.out.println();
}
}
public static void
add(ArrayList<ArrayList<Character>> result,char[][]
number){
for(int i = 0; i < 5; i++){
result.get(i).add(number[i][0]);
result.get(i).add(number[i][1]);
result.get(i).add(number[i][2]);
}
}
}
查看原帖
点赞 评论
相关推荐
查看6道真题和解析 点赞 评论 收藏
分享
牛客热帖
更多
正在热议
更多
# 你的实习产出是真实的还是包装的? #
10050次浏览 148人参与
# 第一份工作应该只看薪资吗 #
252232次浏览 1916人参与
# 米连集团26产品管培生项目 #
10623次浏览 265人参与
# 春招至今,你的战绩如何? #
32336次浏览 295人参与
# 什么专业适合考公 #
57146次浏览 290人参与
# 长得好看会提高面试通过率吗? #
14723次浏览 152人参与
# AI面会问哪些问题? #
5924次浏览 169人参与
# 蚂蚁求职进展汇总 #
157010次浏览 1253人参与
# 找实习记录 #
241140次浏览 1471人参与
# 春招你拿到offer了吗 #
814488次浏览 9891人参与
# 哪些公司校招卡第一学历 #
251010次浏览 861人参与
# 你做过最难的笔试是哪家公司 #
8356次浏览 69人参与
# 从事AI岗需要掌握哪些技术栈? #
2262次浏览 64人参与
# 找AI工作可以去哪些公司? #
1992次浏览 40人参与
# HR最不可信的一句话是__ #
2888次浏览 61人参与
# 一张图晒出你司的标语 #
1757次浏览 26人参与
# 沪漂/北漂你觉得哪个更苦? #
4960次浏览 88人参与
# 毕业论文怎么查AI率 #
79641次浏览 1959人参与
# AI时代,哪个岗位还有“活路” #
5778次浏览 148人参与
# 简历第一个项目做什么 #
34448次浏览 547人参与
# 通信和硬件还有转码的必要吗 #
99016次浏览 633人参与