結果
問題 | No.883 ぬりえ |
ユーザー |
![]() |
提出日時 | 2019-09-13 21:34:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 552 ms |
コンパイル使用メモリ | 73,576 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 10:32:49 |
合計ジャッジ時間 | 1,396 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; int m = 1; while (min(k, m) * m < n) m++; cout << m << '\n'; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { if ((i + j) % m < k && n > 0) { cout << '#'; n--; } else { cout << '.'; } } cout << '\n'; } return 0; }