結果
問題 |
No.115 遠足のおやつ
|
ユーザー |
👑 |
提出日時 | 2020-03-02 14:26:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 410 bytes |
コンパイル時間 | 461 ms |
コンパイル使用メモリ | 63,616 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 21:01:43 |
合計ジャッジ時間 | 1,558 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 WA * 2 |
ソースコード
#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; }