結果

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

ソースコード

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