20250622 baekjoon
This commit is contained in:
parent
76a60e502f
commit
29590cbf41
18
code_study/Baekjoon/c/2577.c
Normal file
18
code_study/Baekjoon/c/2577.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
24
code_study/Baekjoon/c/2920.c
Normal file
24
code_study/Baekjoon/c/2920.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
24
code_study/Baekjoon/c/8958.c
Normal file
24
code_study/Baekjoon/c/8958.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
4
code_study/Baekjoon/js/2577.js
Normal file
4
code_study/Baekjoon/js/2577.js
Normal file
@ -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) );
|
||||||
4
code_study/Baekjoon/js/2920.js
Normal file
4
code_study/Baekjoon/js/2920.js
Normal file
@ -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");
|
||||||
15
code_study/Baekjoon/js/8958.js
Normal file
15
code_study/Baekjoon/js/8958.js
Normal file
@ -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);
|
||||||
|
}
|
||||||
4
code_study/Baekjoon/python/2577.py
Normal file
4
code_study/Baekjoon/python/2577.py
Normal file
@ -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)))
|
||||||
2
code_study/Baekjoon/python/2920.py
Normal file
2
code_study/Baekjoon/python/2920.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
scale = ''.join(input().split())
|
||||||
|
print("ascending" if scale=="12345678" else "descending" if scale=="87654321" else "mixed")
|
||||||
9
code_study/Baekjoon/python/8958.py
Normal file
9
code_study/Baekjoon/python/8958.py
Normal file
@ -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)
|
||||||
Loading…
x
Reference in New Issue
Block a user