DN06
This commit is contained in:
parent
9a87b97eb9
commit
6983d96cf8
|
@ -7,5 +7,16 @@
|
|||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/Development/java/lib/stdlib.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/Development/java/lib/stdlib.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
37
src/DN06.java
Normal file
37
src/DN06.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user