← All problemsSign in

Just Some Permutations 3

CodeChefRating 2083Open on judge ↗

Given two integers N and M, find how many permutations of 1, 2, ..., N (first N natural numbers) are there where the sum of every two adjacent numbers is at most M. Input First line of the input contains an integer T which is the number of test cases. Each of the following T lines contain two integers N and M. Output For each test case output a single one line containing number of such permuta

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start