結果

問題 No.883 ぬりえ
ユーザー k0hn0yutal2l5
提出日時 2019-09-13 21:40:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 58,688 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-04 04:03:26
合計ジャッジ時間 1,692 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    int k = K * K;
    int m = (N / k) * K;
    int r = N % k;
    int d = 0;
    while (d * d < r)
    {
        d++;
    }
    int M = m + d;
    cout << M << endl;
    int cnt = 0;
    for (int i = 0; i < M; i++)
    {
        for (int j = 0; j < M; j++)
        {
            if (i / K == j / K && cnt < N)
            {
                cout << '#';
                cnt++;
            }
            else
                cout << '.';
        }
        cout << endl;
    }
}
0