結果
問題 | No.115 遠足のおやつ |
ユーザー |
![]() |
提出日時 | 2020-06-02 09:59:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 340 bytes |
コンパイル時間 | 692 ms |
コンパイル使用メモリ | 60,288 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 01:56:56 |
合計ジャッジ時間 | 1,773 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#include <iostream> using namespace std; int main(){ int n,d,k;cin>>n>>d>>k; if(n < k || k*(k+1)/2 > d || (n-k+1)*k+(k*(k-1))/2 < d){ cout << -1 << endl; return 0; } for(int i = 1; k >= i; i++){ int z = max(i,d-((n-k+i)*(k-i)+((k-i)*(k+1-i))/2)); cout << z; d-=z; if(i != k)cout << " "; } cout << endl; }