diff --git a/code_study/Baekjoon/c/2577.c b/code_study/Baekjoon/c/2577.c new file mode 100644 index 0000000..4e53ea6 --- /dev/null +++ b/code_study/Baekjoon/c/2577.c @@ -0,0 +1,18 @@ +#include + +int main() { + int a,b,c; + scanf("%d %d %d",&a,&b,&c); + + int cnt[10] = {0,}, res = a*b*c; + while(res!=0) { + cnt[res%10]++; + res /= 10; + } + + for(int i=0; i<10; i++) { + printf("%d\n",cnt[i]); + } + + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/2920.c b/code_study/Baekjoon/c/2920.c new file mode 100644 index 0000000..62665be --- /dev/null +++ b/code_study/Baekjoon/c/2920.c @@ -0,0 +1,24 @@ +#include + +int main() { + int scale[8]; + for(int i=0; i<8; i++) { + scanf("%d",&scale[i]); + } + + int num = scale[0]; + int isAscending = num == 1 ? 1 : 0; + for(int i=1; i<8; i++) { + if(isAscending) num++; + else num--; + if(scale[i]!=num) { + printf("mixed\n"); + return 0; + } + } + + if(isAscending) printf("ascending\n"); + else printf("descending\n"); + + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/8958.c b/code_study/Baekjoon/c/8958.c new file mode 100644 index 0000000..04486bd --- /dev/null +++ b/code_study/Baekjoon/c/8958.c @@ -0,0 +1,24 @@ +#include + +int main() { + int n; + scanf("%d",&n); + while(n--) { + char string[80]; + scanf("%s",string); + int res = 0, score = 0; + for(int i=0; string[i]!='\0'; i++) { + if(string[i]=='O') { + score++; + res += score; + } + else if(score!=0) { + score = 0; + } + } + + printf("%d\n",res); + } + + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/js/2577.js b/code_study/Baekjoon/js/2577.js new file mode 100644 index 0000000..dc83b0a --- /dev/null +++ b/code_study/Baekjoon/js/2577.js @@ -0,0 +1,4 @@ +const [a,b,c] = require("fs").readFileSync(0,"utf8").toString().trim().split('\n').map(Number); +let cnt = new Array(10).fill(0); +(a*b*c).toString().split('').forEach(s => cnt[Number(s)]++); +cnt.forEach(v=> console.log(v) ); \ No newline at end of file diff --git a/code_study/Baekjoon/js/2920.js b/code_study/Baekjoon/js/2920.js new file mode 100644 index 0000000..ddebf73 --- /dev/null +++ b/code_study/Baekjoon/js/2920.js @@ -0,0 +1,4 @@ +const scale = require("fs").readFileSync(0,"utf8").toString().trim().split(' ').join(''); +if(scale === '12345678') console.log("ascending"); +else if(scale === '87654321') console.log("descending"); +else console.log("mixed"); \ No newline at end of file diff --git a/code_study/Baekjoon/js/8958.js b/code_study/Baekjoon/js/8958.js new file mode 100644 index 0000000..32bfb6d --- /dev/null +++ b/code_study/Baekjoon/js/8958.js @@ -0,0 +1,15 @@ +const input = require("fs").readFileSync(0, "utf8").toString().trim().split('\n'); +for(let i=1; i<=Number(input[0]); i++) { + const Str = input[i]; + let [score, res] = [0, 0]; + for(let s of Str) { + if(s==='O') { + score++; + res += score; + } + else if(score!==0) { + score=0; + } + } + console.log(res); +} \ No newline at end of file diff --git a/code_study/Baekjoon/python/2577.py b/code_study/Baekjoon/python/2577.py new file mode 100644 index 0000000..7cbffcf --- /dev/null +++ b/code_study/Baekjoon/python/2577.py @@ -0,0 +1,4 @@ +a, b, c = map(int,[input(), input(), input()]) +res = str(a*b*c) +cnt = [res.count(str(i)) for i in range(10)] +print('\n'.join(map(str,cnt))) \ No newline at end of file diff --git a/code_study/Baekjoon/python/2920.py b/code_study/Baekjoon/python/2920.py new file mode 100644 index 0000000..b0f52f9 --- /dev/null +++ b/code_study/Baekjoon/python/2920.py @@ -0,0 +1,2 @@ +scale = ''.join(input().split()) +print("ascending" if scale=="12345678" else "descending" if scale=="87654321" else "mixed") \ No newline at end of file diff --git a/code_study/Baekjoon/python/8958.py b/code_study/Baekjoon/python/8958.py new file mode 100644 index 0000000..43aa943 --- /dev/null +++ b/code_study/Baekjoon/python/8958.py @@ -0,0 +1,9 @@ +for _ in range(int(input())) : + score = res = 0 + for s in input() : + if s == 'O' : + score += 1 + res += score + elif score != 0 : + score = 0 + print(res) \ No newline at end of file