[Usaco2006 Feb]Backward Digit Sums

时间限制:5s      空间限制:64MB

题目描述

FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= 1="" 2="" 3="" 4="" 6="" 7="" 9="" 16="" n="" <="10)" in="" a="" certain="" order="" and="" then="" sum="" adjacent="" numbers="" to="" produce="" new="" list="" with="" one="" fewer="" number.="" they="" repeat="" this="" until="" only="" single="" number="" is="" left.="" for="" example,="" instance="" of="" the="" game="" (when="" might="" go="" like="" this:="" behind="" fj's="" back,="" cows="" have="" started="" playing="" more="" difficult="" game,="" which="" try="" determine="" starting="" sequence="" from="" final="" total="" n.="" unfortunately,="" bit="" above="" mental="" arithmetic="" capabilities.="" write="" program="" help="" fj="" play="" keep="" up="" cows.="" p="">


输入格式

* Line 1: Two space-separated integers: N and the final sum.


输出格式

* Line 1: An ordering of the integers 1..N that leads to the given sum. If there are multiple solutions, choose the one that is lexicographically least, i.e., that puts smaller numbers first.


样例输入

4 16

样例输出

3 1 2 4

OUTPUT DETAILS:

There are other possible sequences, such as 3 2 1 4, but 3 1 2 4
is the lexicographically smallest.

提示

没有写明提示


题目来源

Silver

Menuappsclose