diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\353\254\270\354\236\220\354\227\264\353\213\244\353\243\250\352\270\260\352\270\260\353\263\270.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\353\254\270\354\236\220\354\227\264\353\213\244\353\243\250\352\270\260\352\270\260\353\263\270.js" new file mode 100644 index 00000000..b82ef862 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\353\254\270\354\236\220\354\227\264\353\213\244\353\243\250\352\270\260\352\270\260\353\263\270.js" @@ -0,0 +1,7 @@ +function solution(s) { + if(s.length === 4 || s.length === 6){ + return s.split("").every(c => !isNaN(c)) + } else { + return false; + } +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\353\266\200\354\241\261\355\225\234\352\270\210\354\225\241\352\263\204\354\202\260\355\225\230\352\270\260.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\353\266\200\354\241\261\355\225\234\352\270\210\354\225\241\352\263\204\354\202\260\355\225\230\352\270\260.js" new file mode 100644 index 00000000..93ace18c --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\353\266\200\354\241\261\355\225\234\352\270\210\354\225\241\352\263\204\354\202\260\355\225\230\352\270\260.js" @@ -0,0 +1,9 @@ +function solution(price, money, count) { + let totalPrice = 0; + + for(let i = 1;i <= count; i++){ + totalPrice += price * i; + } + + return money > totalPrice ? 0 : totalPrice-money +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\225\275\354\210\230\354\235\230\352\260\257\354\210\230\354\231\200\353\215\247\354\205\210.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\225\275\354\210\230\354\235\230\352\260\257\354\210\230\354\231\200\353\215\247\354\205\210.js" new file mode 100644 index 00000000..9f9ae431 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\225\275\354\210\230\354\235\230\352\260\257\354\210\230\354\231\200\353\215\247\354\205\210.js" @@ -0,0 +1,22 @@ +function solution(left, right) { + let divisorArr = []; + let resultArr = []; + for(let j = left; j <= right; j++){ + for(let i = 1; i <= Math.sqrt(j); i++){ + if(j % i === 0) { + divisorArr.push(i); + divisorArr.push(j / i); + } + } + let divisorSet = new Set(divisorArr) + divisorArr = []; + if(divisorSet.size % 2 === 0){ + resultArr.push(j) + }else{ + resultArr.push(-j) + } + divisorSet.clear() + } + console.log(resultArr) + return resultArr.reduce((acc, cur) => acc + cur, 0); +} diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\247\201\354\202\254\352\260\201\355\230\225\353\263\204\354\260\215\352\270\260.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\247\201\354\202\254\352\260\201\355\230\225\353\263\204\354\260\215\352\270\260.js" new file mode 100644 index 00000000..758140ea --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\247\201\354\202\254\352\260\201\355\230\225\353\263\204\354\260\215\352\270\260.js" @@ -0,0 +1,12 @@ +process.stdin.setEncoding('utf8'); +process.stdin.on('data', data => { + const n = data.split(" "); + const garo = Number(n[0]), saero = Number(n[1]); + for(let i = 0; i < saero; i++){ + let star = ''; + for(let j = 0; j < garo; j++){ + star = star + '*'; + } + console.log(star); + } +}); \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\265\234\353\214\200\352\263\265\354\225\275\354\210\230\354\231\200\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\265\234\353\214\200\352\263\265\354\225\275\354\210\230\354\231\200\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230.js" new file mode 100644 index 00000000..172d450d --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\354\265\234\353\214\200\352\263\265\354\225\275\354\210\230\354\231\200\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230.js" @@ -0,0 +1,12 @@ +function solution(n, m) { + return [gcd(n, m), lcm(n, m)]; +} + +function lcm(n, m) { + return (n * m) / gcd(n, m); +} + +function gcd(n, m){ + if(m === 0) return n; + return n > m ? gcd(m, n % m) : gcd(n, m % n); +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\355\226\211\353\240\254\354\235\230\353\215\247\354\205\210.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\355\226\211\353\240\254\354\235\230\353\215\247\354\205\210.js" new file mode 100644 index 00000000..3c8d68b3 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week5/\355\226\211\353\240\254\354\235\230\353\215\247\354\205\210.js" @@ -0,0 +1,11 @@ +function solution(arr1, arr2) { + let answer = []; + for(let i = 0; i < arr1.length; i++){ + let first = []; + for(let j = 0; j < arr1[i].length; j++){ + first.push(arr1[i][j] + arr2[i][j]); + } + answer.push(first); + } + return answer; +} \ No newline at end of file