File tree Expand file tree Collapse file tree 7 files changed +83
-0
lines changed Expand file tree Collapse file tree 7 files changed +83
-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
+
5
+ let max=Number.MIN_SAFE_INTEGER
6
+ let maxIndex;
7
+
8
+ for(let i=0;i<input.length;i++){
9
+ if(input[i]>max){
10
+ max=Number(input[i])
11
+ maxIndex=i+1
12
+ }
13
+ }
14
+
15
+ console.log(max)
16
+ console.log(maxIndex)
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
+ const totalCnt=Number(input[0])
5
+
6
+ let answer=""
7
+ for(let i=1;i<=totalCnt;i++){
8
+ let arr=input[i].split(" ").map(Number)
9
+
10
+ let cnt = arr.shift()
11
+
12
+ let 평균=arr.reduce((a,b)=>a+b)/cnt
13
+
14
+ let 학생수=arr.filter(a=>a>평균).length
15
+
16
+ let 비율 =(학생수/cnt*100).toFixed(3)+"%"
17
+
18
+ answer+=비율+"\n"
19
+
20
+ }
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
+ const number=Number(input[0])
5
+
6
+ let sum=0;
7
+ for(let i=1;i<=number;i++){
8
+ sum+=i
9
+ }
10
+
11
+ console.log(sum)
Original file line number Diff line number Diff line change
1
+ const fs = require("fs")
2
+ const input = fs.readFileSync("/dev/stdin").toString().split("\n")
3
+
4
+ const count=Number(input[0])
5
+
6
+
7
+ let answer=""
8
+ for(let i=1;i<=count;i++){
9
+ answer+=input[i].split(" ").reduce((a,b)=>Number(a)+Number(b))+"\n"
10
+ }
11
+
12
+ console.log(answer)
Original file line number Diff line number Diff line change
1
+ const fs = require("fs")
2
+ const input = fs.readFileSync("/dev/stdin").toString().split("\n")
3
+
4
+ const arr=input[1].split(" ").map(Number)
5
+
6
+ console.log(Math.min(...arr),Math.max(...arr))
Original file line number Diff line number Diff line change
1
+ const fs = require("fs")
2
+ const input = fs.readFileSync("/dev/stdin").toString().split("\n")
3
+
4
+ const number=Number(input[0])
5
+
6
+ for(let i=1; i<=number;i++){
7
+ let star=""
8
+ for(let j=1;j<=i;j++){
9
+ star+="*"
10
+ }
11
+ console.log(star)
12
+ }
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
+ const arr=input[1].split(" ").map(Number)
5
+
6
+ console.log(Math.min(...arr),Math.max(...arr))
You can’t perform that action at this time.
0 commit comments