-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ02020.java
More file actions
31 lines (29 loc) · 791 Bytes
/
J02020.java
File metadata and controls
31 lines (29 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package CODE_PTIT;
import java.util.Scanner;
public class J02020 {
public static int[] C = new int[15];
public static int n, k, cnt = 0;
public static void in(){
for(int i = 1; i <= k; i++){
System.out.printf("%d ", C[i]);
}
System.out.println();
}
public static void Try(int i){
for(int j = C[i-1] + 1; j <= n-k+i; j++){
C[i] = j;
if(i == k){
cnt++;
in();
}
else Try(i+1);
}
}
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
n = inp.nextInt();
k = inp.nextInt();
Try(1);
System.out.println("Tong cong co " + cnt + " to hop");
}
}