結果

問題 No.115 遠足のおやつ
ユーザー JunOnumaJunOnuma
提出日時 2017-06-16 13:06:19
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 466 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 12,820 KB
最終ジャッジ日時 2024-04-08 13:31:28
合計ジャッジ時間 8,198 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,676 KB
testcase_01 AC 13 ms
6,676 KB
testcase_02 AC 13 ms
6,676 KB
testcase_03 AC 11 ms
6,676 KB
testcase_04 AC 52 ms
6,676 KB
testcase_05 AC 12 ms
6,676 KB
testcase_06 AC 11 ms
6,676 KB
testcase_07 AC 13 ms
6,676 KB
testcase_08 AC 13 ms
6,676 KB
testcase_09 AC 12 ms
6,676 KB
testcase_10 AC 11 ms
6,676 KB
testcase_11 AC 12 ms
6,676 KB
testcase_12 AC 13 ms
6,676 KB
testcase_13 AC 12 ms
6,676 KB
testcase_14 AC 12 ms
6,676 KB
testcase_15 AC 33 ms
6,676 KB
testcase_16 AC 13 ms
6,676 KB
testcase_17 AC 12 ms
6,676 KB
testcase_18 AC 11 ms
6,676 KB
testcase_19 AC 11 ms
6,676 KB
testcase_20 AC 12 ms
6,676 KB
testcase_21 AC 13 ms
6,676 KB
testcase_22 AC 888 ms
6,676 KB
testcase_23 AC 11 ms
6,676 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def func(s,e,k,t):
    if s > t or (s+e)*(e-s+1)/2 < t:
        return []
    if k == 1:
        if s <= t and t <= e:
            return [t]
        else:
            return []
    for i in range(s,e+1):
        l = func(i+1,e,k-1,t-i)
        if l != []:
            l.append(i)
            return l
    else:
        return []

n,d,k = map(int, raw_input().split())
l = func(1,n,k,d)
if l == []:
    print -1
else:
    l.reverse()
    print ' '.join(map(str, l))
0