結果
問題 |
No.883 ぬりえ
|
ユーザー |
👑 |
提出日時 | 2022-01-27 21:52:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 737 bytes |
コンパイル時間 | 733 ms |
コンパイル使用メモリ | 70,016 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 04:01:27 |
合計ジャッジ時間 | 3,129 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 WA * 3 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ int n,k;cin>>n>>k; int m = n; vector<int> ans; int ansm = 0; while(k && n>0){ while(k && n-(k-1)*(k-1) <= 0)k--; n-=k*k; ans.push_back(k); ansm+=k; } cout << ansm << endl; int nw = 0; int ind = 0; int indnw = 0; for(int i = 0; ansm > i; i++){ for(int j = 0; ansm > j; j++){ if(nw <= j && j < nw+ans[ind] && m){ cout << "#";m--; }else{ cout << "."; } } cout << endl; indnw++; if(indnw == ans[ind]){ ind++; nw += indnw; indnw = 0; } } }