-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJavaRen4.java
33 lines (30 loc) · 1.08 KB
/
JavaRen4.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
import java.io.*;
class JavaRen4 {
public static void main(String[] args) throws IOException {
BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
String input_string;
int input_size , outer_i , inner_i , wide , Center;
System.out.println("全角文字の入力");
input_string = bin.readLine();
System.out.println("サイズの入力");
input_size = Integer.parseInt( bin.readLine() );
wide = input_size * 2 - 1;
Center = Math.round(wide/2);
for(outer_i=0;outer_i<input_size;outer_i++){
String buf;
if(outer_i == input_size - 1){
buf = input_string;
}else{
buf = "0";
}
for(inner_i=1;inner_i<wide;inner_i++){
if(inner_i >= Center-outer_i & Center+outer_i >= inner_i ){
buf += input_string;
}else{
buf += inner_i;
}
}
System.out.println(buf);
}
}
}