結果
問題 | No.883 ぬりえ |
ユーザー |
![]() |
提出日時 | 2019-09-13 22:57:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 793 ms |
コンパイル使用メモリ | 84,992 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 10:34:54 |
合計ジャッジ時間 | 1,825 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream>#include <vector>#include <map>#include <set>#include <queue>#include <string>#include <iomanip>#include <algorithm>#include <cmath>#include <stdio.h>using namespace std;#define int long longint MOD = 1000000007;signed main() {cin.tie(0);ios::sync_with_stdio(false);int N, K;cin >> N >> K;int M = (N + K - 1) / K;int X = sqrt(N - 1e-9) + 1;M = max(M, X);vector<string> res(M, string(M, '.'));for (int i = 0; i < M; i++) {for (int j = 0; j < M; j++) {if ((i + j) % M < K) {if (N > 0) {res[i][j] = '#';}N--;}}}cout << M << endl;for (int i = 0; i < M; i++) {cout << res[i] << endl;}}