Logo
(追記) (追記ここまで)

6938번 - Partitions 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB91150.000%

문제

Given a positive integer $k,ドル a partition is a sequence of positive integers in decreasing order whose sum is $k$. For example, $(12),ドル $(2,2,2,2,2,2)$ and $(5,3,2,1,1)$ are all partitions of 12ドル$. Given two distinct partitions, $(a_1,a_2,\dots,a_n)$ and $(b_1,b_2,\dots,b_m),ドル we will say that $(a_1,a_2,\dots,a_n) > (b_1,b_2,\dots,b_m)$ if, for the smallest positive integer $t$ such that $t \le n$ and $t \le m,ドル we have $a_t > b_t$.

This ordering lets us put all the partitions of a given integer $k$ in lexicographical order, where each partition in the ordering is greater than all the partitions before it.

For example, if $k = 5,ドル the partitions in lexicographical order are

(1,1,1,1,1)
(2,1,1,1)
(2,2,1)
(3,1,1)
(3,2)
(4,1)
(5)

Given $k$ and a positive integer $a,ドル you are to find the $a^{th}$ partition in the list of partitions of $k$ sorted in lexicographical order.

입력

The input will consist of a line with $N,ドル the number of test cases, followed by $N$ lines, each of the form $k$ $a,ドル where $k$ and $a$ are positive integers.

출력

For each test case, your program should output the $a^{th}$ partition in the list of partitions of $k,ドル or, if $a$ is greater than the number of partitions of $k,ドル output Too big.

제한

예제 입력 1

3
1 1
5 4
5 8

예제 출력 1

(1)
(3,1,1)
Too big

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2001 > CCO 2001 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /