結果

問題 No.883 ぬりえ
ユーザー 438kujira438kujira
提出日時 2019-10-03 23:23:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 855 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 164,384 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 09:46:23
合計ジャッジ時間 2,977 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,948 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 47 ms
6,940 KB
testcase_16 AC 14 ms
6,944 KB
testcase_17 AC 7 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    ll n, k;
    cin >> n >> k;

    ll m = 0;
    ll black = 0;
    while(n > black){
        for(int i = 1; i <= k; i++){
            m++;
            black += i*i-(i-1)*(i-1);
            if(n <= black){
                break;
            }
        }
    }
    cout << m << endl;
    ll cnt = 0;
    for(int i = 0; i < m; i++){
        for(int j = 0; j < m; j++){
            if(i/k*k <= j && j < i/k*k+k && cnt < n){
                cout << "#";
                cnt++;
            }else{
                cout << ".";
            }
        }
        cout << endl;
    }

    return 0;
}
0