結果
問題 | No.883 ぬりえ |
ユーザー |
|
提出日時 | 2019-12-27 21:43:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 882 bytes |
コンパイル時間 | 927 ms |
コンパイル使用メモリ | 97,204 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 19:14:39 |
合計ジャッジ時間 | 2,129 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <limits> #include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = uint32_t; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208; int main() { int n, k; cin >> n >> k; int m = 1; while(n > k*m || n > m*m) m++; int cur = 0; cout << m << "\n"; vector<string> ans(m, string(m, '.')); int cnt = 0; for (int i = 0; i < m; ++i) { for (int j = 0; j < min(k, m); ++j) { if(cnt < n){ ans[i][cur] = '#'; cur = (cur+1)%m; cnt++; } } } for (int i = 0; i < m; ++i) { cout << ans[i] << "\n"; } return 0; }