20250627 baekjoon
This commit is contained in:
parent
387d4b1227
commit
06fc04dace
24
code_study/Baekjoon/c/10989.c
Normal file
24
code_study/Baekjoon/c/10989.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int count[10000] = {0,};
|
||||
int n, temp;
|
||||
scanf("%d",&n);
|
||||
for(int i=0; i<n; i++) {
|
||||
scanf("%d",&temp);
|
||||
count[temp-1]++;
|
||||
}
|
||||
|
||||
int idx=0, cnt=0;
|
||||
while(cnt!=n) {
|
||||
if(count[idx]!=0) {
|
||||
for(int i=0; i<count[idx]; i++) {
|
||||
printf("%d\n",idx+1);
|
||||
}
|
||||
cnt += count[idx];
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
25
code_study/Baekjoon/c/2775.c
Normal file
25
code_study/Baekjoon/c/2775.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int arr[15][14];
|
||||
for(int i=1; i<15; i++) {
|
||||
arr[0][i-1] = i;
|
||||
}
|
||||
for(int i=1; i<15; i++) {
|
||||
for(int j=0; j<14; j++) {
|
||||
arr[i][j] = 0;
|
||||
for(int k=0; k<=j; k++) {
|
||||
arr[i][j] += arr[i-1][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int T,k,n;
|
||||
scanf("%d",&T);
|
||||
while(T--) {
|
||||
scanf("%d %d",&k, &n);
|
||||
printf("%d\n",arr[k][n-1]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
16
code_study/Baekjoon/js/2775.js
Normal file
16
code_study/Baekjoon/js/2775.js
Normal file
@ -0,0 +1,16 @@
|
||||
const N = require("fs").readFileSync(0, "utf8").toString().trim().split('\n').map(Number);
|
||||
let arr = Array.from({length : 15}, () => new Array(14).fill(0));
|
||||
arr[0] = arr[0].map((v,i) => v = i+1);
|
||||
for(let i=1; i<15; i++) {
|
||||
arr[i].forEach((v, idx, row) => {
|
||||
if(idx===0) row[idx] = 1;
|
||||
else {
|
||||
row[idx] = row[idx-1] + arr[i-1][idx];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for(let t=1; t<=N[0]; t++) {
|
||||
let [k, n] = [N[2*t-1], N[2*t]-1];
|
||||
console.log(arr[k][n]);
|
||||
}
|
||||
10
code_study/Baekjoon/python/10989.py
Normal file
10
code_study/Baekjoon/python/10989.py
Normal file
@ -0,0 +1,10 @@
|
||||
import sys
|
||||
cnt = [0]*10000
|
||||
for _ in range(int(sys.stdin.readline())) :
|
||||
cnt[int(sys.stdin.readline().strip())-1] += 1
|
||||
|
||||
result = []
|
||||
for idx, c in enumerate(cnt,start=1) :
|
||||
if c :
|
||||
for _ in range(c):
|
||||
print(idx)
|
||||
11
code_study/Baekjoon/python/2775.py
Normal file
11
code_study/Baekjoon/python/2775.py
Normal file
@ -0,0 +1,11 @@
|
||||
arr = [[i+1 for i in range(14)] for _ in range(15)]
|
||||
for floor, row in enumerate(arr[1:],start=1) :
|
||||
for num, v in enumerate(row):
|
||||
if num==0 :
|
||||
arr[floor][num] = 1
|
||||
else :
|
||||
arr[floor][num] = arr[floor][num-1] + arr[floor-1][num]
|
||||
|
||||
for _ in range(int(input())) :
|
||||
k, n = map(int, [input(), input()])
|
||||
print(arr[k][n-1])
|
||||
Loading…
x
Reference in New Issue
Block a user