結果

問題 No.883 ぬりえ
ユーザー Imperi_NightImperi_Night
提出日時 2019-09-13 22:10:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 1,030 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 93,476 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 15:29:47
合計ジャッジ時間 2,006 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug "<< i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n,k;
  std::cin>>n>>k;

  ll row=n/k+((n%k==0)?0:1);

  while(row*row<n)row++;

  std::cout<<row<<"\n";

  ll cnt=0;

  rep(i,0,row){
    rep(j,0,row){
      if(((i+j)%row<k)&&(cnt<n)){
        std::cout<<'#';
        cnt++;
      }else{
        std::cout<<'.';
      }
    }
    std::cout<<"\n";
  }

  return 0;
}
0