結果
| 問題 |
No.115 遠足のおやつ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-10 01:08:54 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 438 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 7,072 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 16:54:14 |
| 合計ジャッジ時間 | 1,615 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 8 WA * 32 |
ソースコード
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))