38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
public class DN06 {
|
|
static double offset = 0.01;
|
|
static double size = (1 - 2 * offset) / 9;
|
|
|
|
public static void main(String[] args) {
|
|
String input = args[0];
|
|
|
|
StdDraw.setPenRadius(0.005);
|
|
StdDraw.square(0.5, 0.5, 0.5 - offset);
|
|
|
|
for (int i = 1; i < 9; i++) {
|
|
if (i % 3 == 0)
|
|
StdDraw.setPenRadius(0.005);
|
|
else
|
|
StdDraw.setPenRadius(0.001);
|
|
|
|
StdDraw.line(offset, offset + size * i, 1 - offset, offset + size * i);
|
|
}
|
|
|
|
for (int i = 1; i < 9; i++) {
|
|
if (i % 3 == 0)
|
|
StdDraw.setPenRadius(0.005);
|
|
else
|
|
StdDraw.setPenRadius(0.001);
|
|
|
|
StdDraw.line(offset + size * i, offset, offset + size * i, 1 - offset);
|
|
}
|
|
|
|
for (int y = 0; y < 9; y++) {
|
|
for (int x = 0; x < 9; x++) {
|
|
String number = String.valueOf(input.charAt(y * 9 + x));
|
|
if (number.equals("0")) continue;
|
|
StdDraw.text(offset + size / 2 + x * size, 1 - (offset + size / 2 + y * size + offset - 0.005), number);
|
|
}
|
|
}
|
|
}
|
|
}
|