結果

問題 No.883 ぬりえ
ユーザー htensaihtensai
提出日時 2020-01-31 11:12:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 74,356 KB
実行使用メモリ 59,996 KB
最終ジャッジ日時 2023-10-17 08:15:47
合計ジャッジ時間 7,339 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
57,340 KB
testcase_01 AC 133 ms
57,412 KB
testcase_02 AC 132 ms
57,376 KB
testcase_03 AC 133 ms
57,396 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 134 ms
57,304 KB
testcase_08 AC 134 ms
57,408 KB
testcase_09 AC 135 ms
57,120 KB
testcase_10 WA -
testcase_11 AC 136 ms
57,352 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 210 ms
59,996 KB
testcase_16 AC 183 ms
59,500 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 134 ms
57,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int m = (n + k - 1) / k;
        int mod = n % k;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < m; i++) {
            char[] arr = new char[m];
            for (int j = 0; j < m; j++) {
                if (((i >= mod) && (i + j) % m < k) || ((i < mod) && (i + j) % m < k - 1)) {
                    arr[j] = '#';
                } else {
                    arr[j] = '.';
                }
            }
            sb.append(arr).append("\n");
        }
        System.out.println(m);
        System.out.print(sb);
    }
}
0