-
Notifications
You must be signed in to change notification settings - Fork 0
/
Empleh.java
69 lines (67 loc) · 1.94 KB
/
Empleh.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.util.*;
import java.io.*;
/**
* Kattis problem empleh
*
* Difficulty: 2.2
* Solved: 2018-01-17
*/
public class Empleh {
static String b="+---+---+---+---+---+---+---+---+\n"+
"|...|:::|...|:::|...|:::|...|:::|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|:::|...|:::|...|:::|...|:::|...|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|...|:::|...|:::|...|:::|...|:::|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|:::|...|:::|...|:::|...|:::|...|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|...|:::|...|:::|...|:::|...|:::|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|:::|...|:::|...|:::|...|:::|...|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|...|:::|...|:::|...|:::|...|:::|\n"+
"+---+---+---+---+---+---+---+---+\n"+
"|:::|...|:::|...|:::|...|:::|...|\n"+
"+---+---+---+---+---+---+---+---+";
static char[][] board;
static {
String[] ls = b.split("\n");
board = new char[17][];
for(int i=0;i<17;i++){
board[i]=ls[i].toCharArray();
}
}
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String[] white=sc.nextLine().substring(7).split(",");
String[] black=sc.nextLine().substring(7).split(",");
for(String piece:white){
if(piece.length()==3){
char pieceName=piece.charAt(0);
int column=piece.charAt(1)-'a';
int row=piece.charAt(2)-'1';
board[15-2*row][4*column+2]=pieceName;
} else if(piece.length()==2){
int column=piece.charAt(0)-'a';
int row=piece.charAt(1)-'1';
board[15-2*row][4*column+2]='P';
}
}
for(String piece:black){
if(piece.length()==3){
char pieceName=piece.charAt(0);
int column=piece.charAt(1)-'a';
int row=piece.charAt(2)-'1';
board[15-2*row][4*column+2]=Character.toLowerCase(pieceName);
} else if(piece.length()==2) {
int column=piece.charAt(0)-'a';
int row=piece.charAt(1)-'1';
board[15-2*row][4*column+2]='p';
}
}
for(int i=0;i<17;i++){
System.out.println(new String(board[i]));
}
}
}