結果
問題 |
No.883 ぬりえ
|
ユーザー |
|
提出日時 | 2019-09-16 19:04:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 286 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 66,088 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 02:29:01 |
合計ジャッジ時間 | 1,423 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~ main.cpp: In function 'int main()': main.cpp:11:24: warning: 'M' may be used uninitialized [-Wmaybe-uninitialized] 11 | while(M*M<N)M++; | ~^~ main.cpp:7:13: note: 'M' was declared here 7 | int M; | ^
ソースコード
#include<iostream> using namespace std; int N,K; main() { cin>>N>>K; int M; if(N>=K*K)M=(N+K-1)/K; else { while(M*M<N)M++; } cout<<M<<endl; for(int i=0;i<M;i++) { for(int j=0;j<M;j++) { cout<<((i+K<=M?i<=j&&j<i+K:i<=j||j+M<i+K)&&N-->0?'#':'.'); } cout<<endl; } }