結果

問題 No.115 遠足のおやつ
ユーザー dazy
提出日時 2018-06-18 14:09:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 1,501 ms
コンパイル使用メモリ 165,320 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 16:53:03
合計ジャッジ時間 2,654 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 16 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; i++)

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