-
Notifications
You must be signed in to change notification settings - Fork 0
/
2275(2).js
48 lines (39 loc) · 970 Bytes
/
2275(2).js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { off } = require('process')
const readline = require('readline')
const { fileURLToPath } = require('url')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
const data = []
rl.on('line', (input) => {
data.push(input)
}).on('close', () => {
let N = data.shift()
for (let count = 0; count < N; count++) {
let k = Number(data.shift())
let n = Number(data.shift())
let num = []
let tmp = 0
for (let i = 0; i <= k; i++) {
//Ãþ
num.push([1])
for (let j = 1; j < n; j++) {
//È£ (1È£´Â Á¦¿Ü)
if (i == 0) {
num[0].push(j + 1)
}
else {
tmp=num[i][j-1]+num[i-1][j]
num[i].push(tmp)
}
}
}
console.log(num)
}
process.exit()
})
//kÃþ¿¡ nÈ£
// 1 4 10 20 35 //2
// 1 3 6 10 15 //1
// 1 2 3 4 5 //0