This commit is contained in:
암냥 2026-04-18 22:25:36 +09:00
commit 6fef06ae70
No known key found for this signature in database
67 changed files with 436 additions and 1 deletions

5
.clang-format Normal file
View file

@ -0,0 +1,5 @@
# yaml-language-server: $schema=https://json.schemastore.org/clang-format-21.x.json
---
BasedOnStyle: GNU
IndentWidth: 2
---

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
output
output
*.run

77
.zed/config.json Normal file
View file

@ -0,0 +1,77 @@
{
"icon_theme": {
"mode": "dark",
"light": "Zed (Default)",
"dark": "Zed (Default)",
},
"lsp": {
"clangd": {
"fetch": {
"pre_release": true,
},
},
},
"agent": {
"default_model": {
"provider": "zed.dev",
"model": "claude-sonnet-4-6",
"enable_thinking": true,
"effort": "high",
},
"favorite_models": [],
"model_parameters": [],
},
"auto_install_extensions": {
"git-firefly": true,
"nix": true,
"rust": true,
"toml": true,
},
"autosave": "on_focus_change",
"buffer_font_size": 15,
// "experimental.theme_overrides": {
// "background": "#FDF7F9",
// "border": "#F2E6EA",
// "border.variant": "#00000000",
// "drop_target.background": "#8165701a",
// "editor.active_line.background": "#8165700f",
// "editor.active_line_number": "#191013",
// "editor.background": "#00000000",
// "editor.gutter.background": "#00000000",
// "editor.highlighted_line.background": "#8165701a",
// "editor.indent_guide": "#F2E6EA",
// "editor.indent_guide_active": "#E6D5DB",
// "editor.line_number": "#A38F96",
// "element.active": "#81657029",
// "element.hover": "#8165700f",
// "element.selected": "#8165701a",
// "elevated_surface.background": "#FDF7F9",
// "ghost_element.active": "#8165701a",
// "ghost_element.background": "#00000000",
// "ghost_element.hover": "#8165700f",
// "ghost_element.selected": "#81657024",
// "hint.background": "#F7EBEE",
// "panel.background": "#00000000",
// "panel.focused_border": "#00000000",
// "panel.indent_guide": "#F2E6EA",
// "panel.indent_guide_active": "#D9C4CC",
// "panel.indent_guide_hover": "#E6D5DB",
// "scrollbar.thumb.background": "#A38F9680",
// "scrollbar.track.background": "#00000000",
// "scrollbar.track.border": "#00000000",
// "status_bar.background": "#FDF7F9",
// "surface.background": "#FDF7F900",
// "tab.active_background": "#8165701a",
// "tab.inactive_background": "#00000000",
// "tab_bar.background": "#00000000",
// "terminal.background": "#00000000",
// "title_bar.background": "#FDF7F9",
// "toolbar.background": "#00000000",
// },
"theme": {
"dark": "Catppuccin Mocha (pink) - No Italics",
"light": "One Light",
"mode": "dark",
},
"ui_font_size": 16,
}

15
04/ex01.c Normal file
View file

@ -0,0 +1,15 @@
#include <stdio.h>
int main() {
int A, B;
printf("정수 A : ");
scanf("%d", &A);
printf("정수 B : ");
scanf("%d", &B);
if (A % B == 0) {
printf("정수 B 는 정수 A의 약수입니다.");
}
return 0;
}

21
04/ex02.c Normal file
View file

@ -0,0 +1,21 @@
#include <stdio.h>
int main() {
int a,b,c,d;
printf("4개의 정수 입력 : ");
scanf("%d %d %d %d", &a, &b, &c, &d);
if (a > b && a > c && a > d) {
printf("가장 큰 수 : %d", a);
}
else if (b > a && b > c && b > d) {
printf("가장 큰 수 : %d", b);
}
else if (c > a && c > b && c > d) {
printf("가장 큰 수 : %d", c);
}
else {
printf("가장 큰 수 : %d", d);
}
}

19
04/ex03.c Normal file
View file

@ -0,0 +1,19 @@
#include <stdio.h>
int main() {
int a,b,c;
printf("3개의 정수 입력 : ");
scanf("%d %d %d", &a, &b, &c);
// 입력한 3개의 숫자중 같은 숫자 갯수 출려r
if (a == b && b == c) {
printf("입력한 3개의 숫자 중 같은 숫자 : 3개");
}
else if (a == b || a == c || b == c) {
printf("입력한 3개의 숫자 중 같은 숫자 : 2개");
}
else {
printf("입력한 3개의 숫자 중 같은 숫자 : 0개");
}
}

21
04/ex04.c Normal file
View file

@ -0,0 +1,21 @@
#include <stdio.h>
int main() {
int a,b;
printf("정수 2개 입력 : ");
scanf("%d %d", &a, &b);
if (a % 2 == 0 && b % 2 == 0) {
printf("짝수의 개수 : 2개\n");
printf("홀수의 개수 : 0개");
}
else if (a % 2 == 0 || b % 2 == 0) {
printf("짝수의 개수 : 1개\n");
printf("홀수의 개수 : 1개");
}
else {
printf("짝수의 개수 : 0개\n");
printf("홀수의 개수 : 2개");
}
}

15
04/ex05.c Normal file
View file

@ -0,0 +1,15 @@
#include <stdio.h>
int main() {
int a,b,c;
printf("삼각형 세 변의 값 입력: ");
scanf("%d %d %d", &a, &b, &c);
if (a + b > c && a + c > b && b + c > a) {
printf("삼각형 가능 여부 : yes");
}
else {
printf("삼각형 가능 여부 : no");
}
}

20
04/ex06.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdio.h>
int main() {
int a,b;
printf("정수 2개 입력\n");
printf("정수 A: ");
scanf("%d", &a);
printf("정수 B: ");
scanf("%d", &b);
if (a > b) {
printf("정수 A가 정수 B보다 크다.");
} else if (a == b){
printf("정수 A와 정수 B가 같다.");
}
else {
printf("정수 B가 정수 A보다 크다.");
}
}

15
04/ex07.c Normal file
View file

@ -0,0 +1,15 @@
#include <stdio.h>
int main() {
int pw;
printf("비밀번호 입력 : ");
scanf("%d", &pw);
if (pw == 1234) {
printf("비밀번호가 맞습니다.");
}
else {
printf("비밀번호가 틀립니다.");
}
}

31
04/ex08.c Normal file
View file

@ -0,0 +1,31 @@
#include <stdio.h>
int main() {
int month;
printf("월(Month) 입력 : ");
scanf("%d", &month);
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
printf("%d월은 31일까지 있습니다", month);
break;
case 4:
case 6:
case 9:
case 11:
printf("%d월은 30일까지 있습니다", month);
break;
case 2:
printf("%d월은 28일까지 있습니다", month);
break;
default:
printf("잘못된 월입니다.");
break;
}
}

34
04/ex09.c Normal file
View file

@ -0,0 +1,34 @@
#include <stdio.h>
int main() {
int year, month, days;
printf("<윤년 계산>\n");
printf("년도 입력(year) : ");
scanf("%d", &year);
printf("월(Month) 입력 : ");
scanf("%d", &month);
int isLeap = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
switch (month) {
case 1: case 3: case 5: case 7:
case 8: case 10: case 12:
days = 31;
break;
case 4: case 6:
case 9: case 11:
days = 30;
break;
case 2:
days = isLeap ? 29 : 28;
break;
default:
printf("잘못된 월입니다. (1~12 사이 입력)\n");
return 1;
}
printf("%d년 %d월은 %d일까지 있습니다.\n", year, month, days);
return 0;
}

33
04/ex10.c Normal file
View file

@ -0,0 +1,33 @@
#include <stdio.h>
int main() {
int a,b;
char operator;
printf("<두 개의 정수와 사칙연산자 입력>\n");
printf("정수 2개 입력 : ");
scanf("%d %d", &a, &b);
printf("연산자입력(+, -, *, /) : ");
scanf(" %c", &operator);
printf("%d %c %d를 수행합니다.\n", a, operator, b);
printf("결과 : ");
switch (operator) {
case '+':
printf("%d", a + b);
break;
case '-':
printf("%d", a - b);
break;
case '*':
printf("%d", a * b);
break;
case '/':
printf("%.1lf", a / (double)b);
break;
default:
printf("잘못된 연산자입니다.\n");
break;
}
}

59
index.js Normal file
View file

@ -0,0 +1,59 @@
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', (line) => {
if (!line) return;
const k = BigInt(line);
let a, b, c, op1, op2;
// k = a^2 + b^2 - c^2 구조로 풀기
// k - a^2 = b^2 - c^2 = (b-c)(b+c)
// 계산의 편의를 위해 a=1 또는 a=2를 선택
// 1. a=1 선택
a = 1n;
let target = k - (a * a);
// target이 홀수라면: (n+1)^2 - n^2 = 2n + 1 = target
// 2n = target - 1 => n = (target - 1) / 2
if (target % 2n !== 0n) {
let n = (target - 1n) / 2n;
b = n + 1n;
c = n;
op1 = '+';
op2 = '-';
}
// target이 짝수라면: a=2로 변경하여 target을 홀수로 만듦
else {
a = 2n;
target = k - (a * a);
let n = (target - 1n) / 2n;
b = n + 1n;
c = n;
op1 = '+';
op2 = '-';
}
// 만약 c가 0이 되는 경우 (target이 1인 경우) 등 예외 처리
// 문제 조건 1 <= a, b, c를 맞추기 위해 조정
if (c === 0n) {
// k = a^2 + b^2 - c^2 가 안되면 다른 조합 시도 (k는 충분히 큼)
// 보통 k가 1 이상이므로 위 로직에서 a, b, c >= 1을 만족하는 해가 대부분 존재함
// k=1인 경우: 1 = 1^2 + 1^2 - 1^2 (1 + 1 - 1)
if (k === 1n) {
console.log("1 + 1 - 1");
} else {
// 일반적인 출력
console.log(`${a} ${op1} ${b} ${op2} ${c}`);
}
} else {
console.log(`${a} ${op1} ${b} ${op2} ${c}`);
}
rl.close();
});

14
layer7/awesome.c Normal file
View file

@ -0,0 +1,14 @@
#include <stdio.h>
int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n-1);
}
int main() {
int n;
scanf("%d", &n);
printf("%d", factorial(n));
return 0;
}

6
layer7/fantastic.c Normal file
View file

@ -0,0 +1,6 @@
#include <stdio.h>
int main() {
return 0;
}

35
layer7/sans.c Normal file
View file

@ -0,0 +1,35 @@
#include <stdio.h>
int main() {
int count;
scanf("%d", &count);
int n[count];
// for (int i = 0; i < count; i++) {
// scanf("%d", &n[i]);
// }
// for (int i = 0; i <= count; i++) {
// int sum = 0;
// for (int j = 0; j <= i; j++) {
// sum += n[j];
// }
// if (i == count){
// printf("\n");
// continue;
// }
// printf("%d ", sum);
// }
//
int sum = 0;
for (int i = 0; i < count; i++) {
scanf("%d", &n[i]);
sum += n[i];
n[i] = sum;
}
for (int i = 0; i < count; i++) printf("%d ", n[i]);
printf("\n");
return 0;
}

BIN
output/a_blazxf Executable file

Binary file not shown.

BIN
output/a_ckrmpy Executable file

Binary file not shown.

BIN
output/a_etvxub Executable file

Binary file not shown.

BIN
output/a_hkaxbe Executable file

Binary file not shown.

BIN
output/a_iewwff Executable file

Binary file not shown.

BIN
output/a_kcgxvw Executable file

Binary file not shown.

BIN
output/a_uendwc Executable file

Binary file not shown.

BIN
output/a_ybdfvl Executable file

Binary file not shown.

BIN
output/awesome_rcabkw Executable file

Binary file not shown.

BIN
output/ex01_fclfyf Executable file

Binary file not shown.

BIN
output/ex01_ffjbjb Executable file

Binary file not shown.

BIN
output/ex01_ytzccs Executable file

Binary file not shown.

BIN
output/ex02 Executable file

Binary file not shown.

BIN
output/ex02_mfwhia Executable file

Binary file not shown.

BIN
output/ex02_qdtsmx Executable file

Binary file not shown.

BIN
output/ex02_wwnjhw Executable file

Binary file not shown.

BIN
output/ex02_ypeulo Executable file

Binary file not shown.

BIN
output/ex03_jsaztf Executable file

Binary file not shown.

BIN
output/ex03_lctjsv Executable file

Binary file not shown.

BIN
output/ex03_lrddkr Executable file

Binary file not shown.

BIN
output/ex03_mrnfuc Executable file

Binary file not shown.

BIN
output/ex03_qdbdka Executable file

Binary file not shown.

BIN
output/ex03_upvrpk Executable file

Binary file not shown.

BIN
output/ex03_yuhwui Executable file

Binary file not shown.

BIN
output/ex03_zebfne Executable file

Binary file not shown.

BIN
output/ex03_ztxvbg Executable file

Binary file not shown.

BIN
output/ex05 Executable file

Binary file not shown.

BIN
output/ex06_dwjfya Executable file

Binary file not shown.

BIN
output/ex06_orsdgr Executable file

Binary file not shown.

BIN
output/ex06_wxbdkt Executable file

Binary file not shown.

BIN
output/ex06_zsgoqs Executable file

Binary file not shown.

BIN
output/ex07_dhuxxp Executable file

Binary file not shown.

BIN
output/ex07_nixeaw Executable file

Binary file not shown.

BIN
output/ex08_bwoldf Executable file

Binary file not shown.

BIN
output/ex09_yevjcg Executable file

Binary file not shown.

BIN
output/ex10_ecskqd Executable file

Binary file not shown.

BIN
output/ex10_fdurbn Executable file

Binary file not shown.

BIN
output/ex10_pkhcdz Executable file

Binary file not shown.

BIN
output/ex10_rrnqlq Executable file

Binary file not shown.

BIN
output/ex10_suixva Executable file

Binary file not shown.

BIN
output/playground_dgodqp Executable file

Binary file not shown.

BIN
output/playground_enmxcf Executable file

Binary file not shown.

BIN
output/playground_ghamgt Executable file

Binary file not shown.

BIN
output/playground_ljtymd Executable file

Binary file not shown.

BIN
output/sub01_ikhsla Executable file

Binary file not shown.

BIN
output/sub01_oymvzj Executable file

Binary file not shown.

BIN
output/sub01_zpqjkp Executable file

Binary file not shown.

BIN
output/sub02_jemuwh Executable file

Binary file not shown.

BIN
output/sub02_qkhqto Executable file

Binary file not shown.

15
shell.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = with pkgs; [
gcc
gdb
gnumake
pkg-config
icu
];
shellHook = ''
# Work around .NET tools failing on systems where ICU cannot be resolved.
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
'';
}