File tree 4 files changed +75
-0
lines changed
4 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ const fs=require("fs")
2
+ const input=fs.readFileSync("index.txt").toString().split("\n")
3
+
4
+ // 점수/M*100
5
+
6
+ const cnt = Number(input[0])
7
+
8
+ let arr=input[1].split(" ").map(Number)
9
+
10
+ let maxValue=Math.max(...arr)
11
+
12
+ let maxValue=arr.reduce((a,b)=>Math.max(a,b))
13
+
14
+ console.log(maxValue)
15
+
16
+ let sum=0;
17
+ for(let item of arr){
18
+ sum+=item/maxValue*100
19
+ }
20
+
21
+ console.log(sum/cnt)
Original file line number Diff line number Diff line change
1
+ const fs = require("fs")
2
+ const input = fs.readFileSync("index.txt").toString().split("\n")
3
+
4
+
5
+ const arr = input[0].split(" ")
6
+
7
+ const sortedArr = arr.sort(((a, b) => a - b))
8
+
9
+ let answer=""
10
+ for(let i=0;i<sortedArr.length;i++){ answer+=sortedArr[i]+" "
11
+
12
+ }
13
+
14
+ console.log(answer)
Original file line number Diff line number Diff line change
1
+ const fs = require("fs")
2
+ const input = fs.readFileSync("index.txt").toString().split("\n")
3
+
4
+
5
+
6
+ let num=Number(input[0])
7
+ let arr=[]
8
+
9
+ for(let i=1;i<=num;i++){
10
+ arr.push(Number(input[i]))
11
+ }
12
+
13
+
14
+
15
+ const sortedArr= arr.map(Number).sort((a,b)=>a-b)
16
+
17
+ let answer=""
18
+
19
+ for(let i=0;i<sortedArr.length;i++){
20
+ answer+=sortedArr[i]+"\n"
21
+ }
22
+
23
+ console.log(answer)
24
+
25
+
26
+
27
+
28
+
Original file line number Diff line number Diff line change
1
+ const fs = require("fs")
2
+ const input = fs.readFileSync("index.txt").toString().split("\n")
3
+
4
+
5
+ const num=Number(input[0].split(" ")[0])
6
+ const k=Number(input[0].split(" ")[1])
7
+ const arr=input[1].split(" ").map(Number)
8
+
9
+
10
+ const sorted=arr.sort((a,b)=>a-b)
11
+
12
+ console.log(sorted[k-1])
You can’t perform that action at this time.
0 commit comments