Skip to content

Commit ddc57aa

Browse files
Merge pull request #545 from eric-hjh/main
[황장현] 68차 라이브 코테 제출
2 parents 3e30daa + 8c55002 commit ddc57aa

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

live6/test68/문제1/황장현.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const input = require('fs')
2+
.readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3+
.toString()
4+
.trim()
5+
.split('\n')
6+
.map((el) => el.split(' ').map(Number));
7+
8+
function solution(input) {
9+
const [E, S, M] = input[0];
10+
let year = 1;
11+
12+
while (true) {
13+
if (
14+
(year - E) % 15 === 0 &&
15+
(year - S) % 28 === 0 &&
16+
(year - M) % 19 === 0
17+
) {
18+
return year;
19+
}
20+
year++;
21+
}
22+
}
23+
24+
console.log(solution(input));

live6/test68/문제2/황장현.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const input = require('fs')
2+
.readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3+
.toString()
4+
.trim()
5+
.split('\n')
6+
.map((el) => el.split(' ').map(Number));
7+
8+
function solution(input) {
9+
let [N, KIM, IM] = input[0];
10+
let answer = 0;
11+
while (KIM !== IM) {
12+
KIM = Math.ceil(KIM / 2);
13+
IM = Math.ceil(IM / 2);
14+
answer++;
15+
}
16+
return answer;
17+
}
18+
19+
console.log(solution(input));

live6/test68/문제3/황장현.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function solution(s) {
2+
const words = s.split(' ');
3+
4+
for (let i = 0; i < words.length; i++) {
5+
let lowerWord = words[i].toLowerCase();
6+
if (/[a-z]/.test(lowerWord[0])) {
7+
lowerWord = lowerWord.replace(/^[a-z]/, (match) => match.toUpperCase());
8+
}
9+
words[i] = lowerWord;
10+
}
11+
return words.join(' ');
12+
}
13+
14+
console.log(solution('3people unFollowed me'));

0 commit comments

Comments
 (0)