Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Chie13115168098 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int h = 0;
- int w = 0;
- StringBuilder sb = new StringBuilder();
- while (true) {
- try {
- if (in.hasNext()) { h = new Integer(in.next()); }
- if (in.hasNext()) { w = new Integer(in.next()); }
- }
- catch (Exception e) {
- in.close(); System.exit(1);
- }
- if (h == 0 || w == 0) { break; }
- for (int i = 0; i < h; i++) {
- for (int j = 0; j < w; j++) {
- if (i == 0 || i == h - 1 || j == 0 || j == w - 1) {
- sb.append("#");
- }
- else {
- sb.append(".");
- }
- }
- sb.append("\n");
- }
- sb.append("\n");
- }
- System.out.print(sb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement