結果

問題 No.115 遠足のおやつ
ユーザー lllllll88938494
提出日時 2022-03-15 12:17:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 5,000 ms
コード長 400 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 76,908 KB
最終ジャッジ日時 2024-09-22 04:14:30
合計ジャッジ時間 3,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d,k=map(int,input().split())

def  cal(x,cnt,total):
    if cnt < k-1:
        if (d-total)//(k-cnt) >= n:
            return
    if cnt == k:
        if total == d:
            print(*x)
            exit()
        return
    for i in range(x[-1]+1,n+1):
        if total + i > d:
            continue
        cal(x+[i],cnt+1,total+i)
        
for i in range(1,n+1):
    cal([i],1,i)
    
print(-1)
0