結果

問題 No.115 遠足のおやつ
ユーザー dazy
提出日時 2018-06-20 01:48:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 410 bytes
コンパイル時間 1,504 ms
コンパイル使用メモリ 166,300 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 17:22:37
合計ジャッジ時間 2,738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 15 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, d, k;
    cin >> n >> d >> k;
    if(k*(k+1)/2>d ||n*k-(k-1)*k/2<d) printf("-1\n");
    else {
        for(int i=1; k; i++) {
            if(n*(k-1)-(k-2)*(k-1)/2>=d-i) {
                if(k==1 && d-i!=0) continue;
                printf("%d\n", i);
                k--;
                d-=i;
            }
        }
    }
    return 0;
}
0