結果
問題 |
No.883 ぬりえ
|
ユーザー |
|
提出日時 | 2020-08-04 20:03:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 598 bytes |
コンパイル時間 | 714 ms |
コンパイル使用メモリ | 72,804 KB |
最終ジャッジ日時 | 2025-01-12 14:24:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> #include <string> void solve() { int n, k; std::cin >> n >> k; int m = 0; while (m * k < n || m * m < n) ++m; std::vector<std::string> ans(m, std::string(m, '.')); for (int i = 0; i < m; ++i) { for (int j = 0; j < m; ++j) { if (n == 0) continue; ans[j][(i + j) % m] = '#'; --n; } } std::cout << m << "\n"; for (const auto& s : ans) std::cout << s << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }