結果

問題 No.883 ぬりえ
ユーザー ezakihalfmoonezakihalfmoon
提出日時 2019-09-13 21:35:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 1,565 ms
コンパイル使用メモリ 166,256 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 04:01:36
合計ジャッジ時間 2,922 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    int m = n / (k*k) * k;
    int r = n % (k*k);
    int more = 0;
    for(int i = 0; i <= k; i++){
        if(r <= i*i){
            more = i;
            break;
        }
    }
    m += more;
    cout << m << endl;
    for(int i = 0; i < m; i++){
        for(int j = 0; j < m; j++){
            if(n != 0 && i/k == j/k){
                cout << '#';
                n--;
            }else{
                cout << '.';
            }
        }
        cout << endl;
    }
}
0