-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2752-number.js
More file actions
49 lines (45 loc) ยท 1.25 KB
/
2752-number.js
File metadata and controls
49 lines (45 loc) ยท 1.25 KB
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
49
//{๋ฌธ์ }
//๋๊ท๋ ์ธ์๋ฅผ ํ๋ค๊ฐ ์ ๋ ฌ์ด ํ๊ณ ์ถ์ด์ก๋ค.
// ์ซ์ ์ธ ๊ฐ๋ฅผ ์๊ฐํ ๋ค์, ์ด๋ฅผ ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํ๊ณ ์ถ์ด ์ก๋ค.
// ์ซ์ ์ธ ๊ฐ๊ฐ ์ฃผ์ด์ก์ ๋, ๊ฐ์ฅ ์์ ์, ๊ทธ ๋ค์ ์, ๊ฐ์ฅ ํฐ ์๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
//์ฝ๋
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let sum = 0;
rl.on("line", function (line) {
let input = line.split(" ");
input[0] = Number(input[0]);
input[1] = Number(input[1]);
input[2] = Number(input[2]);
for (let i = 0; i <= 2; i++) {
if (input[0] > input[1]) {
sum = input[0];
input[0] = input[1];
input[1] = sum;
} else if (input[1] > input[2]) {
sum = input[1];
input[1] = input[2];
input[2] = sum;
} else if (input[0] > input[2]) {
sum = input[0];
input[0] = input[2];
input[2] = sum;
}
}
console.log(input[0], input[1], input[2]);
rl.close();
}).on("close", function () {
process.exit();
});
//๋ค๋ฅธ ํ์ด
const input = require("fs")
.readFileSync("/dev/stdin")
.toString()
.trim()
.split(" ")
.map(Number);
input.sort((a, b) => a - b);
console.log(input.join(" "));