report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Permutations - FlandreOJ: Flandre Online Judge

Permutations

Time limit: 1000 ms
Memory limit: 256 MB
Print all permutations of $k$ elements from the positive integers $1,2,3,\ldots,n$. A permutation is a way of selecting items from a larger group, where the order matters. ### Input - One line containing two integers $n$ and $k$. ### Output - Each line contains $k$ integers representing a permutation. The output should follow dictionary order. ### Constraints - $1 \le k < n \le 7$. ### Example Input: ``` 3 2 ``` Output: ``` 1 2 1 3 2 1 2 3 3 1 3 2 ```
Backtracking
Binary string
ABC string
Subset sum
Subset
Permutations
Group division
Knight's tour
N-queens problem
Maximum path
Knapsack
Build array
Sudoku
Minesweeper
Travelling Salesman Problem
Word search
Topic
Basic
Rating 800
Solution (1) Solution