結果

問題 No.115 遠足のおやつ
ユーザー roiti46roiti46
提出日時 2015-02-10 01:08:54
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 6,380 KB
実行使用メモリ 5,988 KB
最終ジャッジ日時 2023-09-05 21:33:41
合計ジャッジ時間 2,223 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N,D,K = map(int,raw_input().split())
s = []
for i in xrange(1,N+1):
    if sum(s)+i == D or sum(s)+i < D and D-(sum(s)+i) > i:
        s.append(i)
while len(s) > K:
    for i in range(1,len(s))[::-1]:
        if s[i]+s[i-1] <= N and s[i]+s[i-1] not in s:
            s = s[:i-1]+[s[i-1]+s[i]]+s[i+1:]
            s = sorted(s)
            break
    else:
        print s
        print -1
        break
else:
    print " ".join(map(str,s))
0