結果

問題 No.115 遠足のおやつ
ユーザー JunOnuma
提出日時 2017-06-16 13:02:00
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 443 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 12,964 KB
最終ジャッジ日時 2024-10-01 06:43:30
合計ジャッジ時間 7,888 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

def func(s,e,k,t):
    if s > 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