Skip to content

Commit f04e09f

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 43c6699 + c4cea7a commit f04e09f

7 files changed

Lines changed: 315 additions & 6 deletions

File tree

.github/workflows/ai-review.yml

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,90 @@ jobs:
1010
permissions:
1111
contents: write
1212
steps:
13-
- uses: choam2426/AI-Algorithm-Mentor@v5
13+
- name: AI Review (Attempt 1)
14+
id: attempt1
15+
continue-on-error: true
16+
uses: choam2426/AI-Algorithm-Mentor@v5
1417
with:
1518
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
LLM_PROVIDER: google # openai, google, anthropic
17-
MODEL_NAME: gemini-3-pro-preview # 모델명 (선택사항)
19+
LLM_PROVIDER: google
20+
MODEL_NAME: gemini-3-pro-preview
1821
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
19-
REVIEW_LANGUAGE: korean # korean, english, etc..
22+
REVIEW_LANGUAGE: korean
23+
24+
- name: Wait before retry (10초)
25+
if: steps.attempt1.conclusion == 'failure'
26+
run: |
27+
echo "재시도 대기 중... (10초)"
28+
sleep 10
29+
30+
- name: AI Review (Attempt 2)
31+
id: attempt2
32+
if: steps.attempt1.conclusion == 'failure'
33+
continue-on-error: true
34+
uses: choam2426/AI-Algorithm-Mentor@v5
35+
with:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
LLM_PROVIDER: google
38+
MODEL_NAME: gemini-3-pro-preview
39+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
40+
REVIEW_LANGUAGE: korean
41+
42+
- name: Wait before retry (15초)
43+
if: steps.attempt2.conclusion == 'failure'
44+
run: |
45+
echo "재시도 대기 중... (15초)"
46+
sleep 15
47+
48+
- name: AI Review (Attempt 3)
49+
id: attempt3
50+
if: steps.attempt2.conclusion == 'failure'
51+
continue-on-error: true
52+
uses: choam2426/AI-Algorithm-Mentor@v5
53+
with:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
LLM_PROVIDER: google
56+
MODEL_NAME: gemini-3-pro-preview
57+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
58+
REVIEW_LANGUAGE: korean
59+
60+
- name: Wait before retry (20초)
61+
if: steps.attempt3.conclusion == 'failure'
62+
run: |
63+
echo "재시도 대기 중... (20초)"
64+
sleep 20
65+
66+
- name: AI Review (Attempt 4)
67+
id: attempt4
68+
if: steps.attempt3.conclusion == 'failure'
69+
continue-on-error: true
70+
uses: choam2426/AI-Algorithm-Mentor@v5
71+
with:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
LLM_PROVIDER: google
74+
MODEL_NAME: gemini-3-pro-preview
75+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
76+
REVIEW_LANGUAGE: korean
77+
78+
- name: Wait before retry (30초)
79+
if: steps.attempt4.conclusion == 'failure'
80+
run: |
81+
echo "재시도 대기 중... (30초)"
82+
sleep 30
83+
84+
- name: AI Review (Attempt 5)
85+
id: attempt5
86+
if: steps.attempt4.conclusion == 'failure'
87+
uses: choam2426/AI-Algorithm-Mentor@v5
88+
with:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
LLM_PROVIDER: google
91+
MODEL_NAME: gemini-3-pro-preview
92+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
93+
REVIEW_LANGUAGE: korean
94+
95+
- name: Check if all attempts failed
96+
if: steps.attempt5.conclusion == 'failure'
97+
run: |
98+
echo "::error::모든 AI 리뷰 시도가 실패했습니다 (5회 시도)"
99+
exit 1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ algorithm/
6565
| 이름 | 누적 |
6666
| ------ | ---- |
6767
| 박예진 | 0원 |
68-
| 김지호 | 0원 |
68+
| 김지호 | 5000원 |
6969
| 심수연 | 0원 |
7070
| 정건우 | 0원 |
71-
| 공예영 | 0원 |
71+
| 공예영 | 3000원 |
7272

7373
---
7474

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const fs = require("fs");
2+
const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt";
3+
const [nk, input] = fs.readFileSync(filePath).toString().trim().split("\n");
4+
const [N, K] = nk.split(" ").map(Number);
5+
const device = input.split(" ").map(Number);
6+
7+
const multitap = new Set();
8+
let cnt = 0;
9+
10+
device.forEach((e, idx) => {
11+
if (multitap.has(e) || multitap.size < N) multitap.add(e);
12+
else {
13+
const temp = new Set(multitap);
14+
for (let i = idx + 1; i < K; i++) {
15+
if (temp.size === 1) break;
16+
temp.delete(device[i]);
17+
}
18+
19+
const [first] = [...temp];
20+
multitap.delete(first);
21+
multitap.add(e);
22+
cnt++;
23+
}
24+
});
25+
26+
console.log(cnt);

박예진/2주차/260108.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//https://www.acmicpc.net/problem/1535
2+
3+
#include <iostream>
4+
#include <algorithm>
5+
6+
using namespace std;
7+
8+
int ans, N, L[21], J[21];
9+
int dp[101];
10+
bool visited[21];
11+
12+
int knapsack(){
13+
for(int i = 0; i < N; i++){
14+
for(int j = 99; j >= L[i]; j--){
15+
dp[j] = max(dp[j], dp[j - L[i]] + J[i]);
16+
}
17+
}
18+
return dp[99];
19+
}
20+
21+
int main(){
22+
ios_base::sync_with_stdio(false);
23+
cin.tie(NULL); cout.tie(NULL);
24+
25+
cin >> N;
26+
for(int i = 0; i < N; i++){
27+
cin >> L[i];
28+
}
29+
for(int i = 0; i < N; i++){
30+
cin >> J[i];
31+
}
32+
33+
cout << knapsack();
34+
}

박예진/2주차/260109.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//https://www.acmicpc.net/problem/3584
2+
3+
#include <algorithm>
4+
#include <iostream>
5+
using namespace std;
6+
7+
int parent[10001];
8+
bool visited[10001];
9+
10+
int main() {
11+
ios::sync_with_stdio(false);
12+
cin.tie(NULL), cout.tie(NULL);
13+
14+
int T;
15+
cin >> T;
16+
17+
while (T--) {
18+
int N; // 노드 수
19+
cin >> N;
20+
21+
for(int i = 1; i <= N; i++){
22+
visited[i] = 0;
23+
parent[i] = i;
24+
}
25+
26+
for(int i = 0; i < N - 1; i++){
27+
int A, B; // A가 B의 부모
28+
cin >> A >> B;
29+
parent[B] = A;
30+
}
31+
32+
// LCA 최소 공통 조상 찾기
33+
int u,v;
34+
cin >> u >> v;
35+
visited[u] = 1;
36+
37+
// 루트 노드까지
38+
while(u != parent[u]){
39+
u = parent[u];
40+
visited[u] = 1;
41+
}
42+
43+
while(true) {
44+
if (visited[v]){
45+
cout << v << "\n";
46+
break;
47+
}
48+
v = parent[v];
49+
}
50+
}
51+
}

심수연/2주차/260108.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# https://www.acmicpc.net/problem/2667
2+
3+
import sys
4+
from collections import deque
5+
input = sys.stdin.readline
6+
7+
N = int(input())
8+
9+
graph = []
10+
11+
for _ in range(N):
12+
graph.append(list(map(int, input().strip())))
13+
14+
visited = [[False] * N for _ in range(N)]
15+
16+
# 상하좌우
17+
dx = [-1, 1, 0, 0]
18+
dy = [0, 0, -1, 1]
19+
20+
# 하나의 단지
21+
def bfs(x, y):
22+
q = deque()
23+
q.append((x, y))
24+
visited[x][y] = True
25+
26+
home = 1 # 단지 내 집 수
27+
28+
while q:
29+
x, y = q.popleft()
30+
31+
for i in range(4):
32+
nx = x + dx[i]
33+
ny = y + dy[i]
34+
35+
if 0 <= nx < N and 0 <= ny < N: # 범위 내
36+
if not visited[nx][ny] and graph[nx][ny] == 1: # 방문 X, 그래프에 있다면
37+
visited[nx][ny] = True
38+
q.append((nx, ny))
39+
home += 1 # 단지 집 수 추가
40+
41+
return home # 한 단지 집 개수
42+
43+
answer = []
44+
45+
for i in range(N):
46+
for j in range(N):
47+
if not visited[i][j] and graph[i][j] == 1:
48+
group = bfs(i, j)
49+
answer.append(group)
50+
51+
answer.sort() # 오름차순
52+
53+
print(len(answer))
54+
for i in range(len(answer)):
55+
print(answer[i])

정건우/2주차/260109.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//https://www.acmicpc.net/problem/1359
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
import java.util.HashSet;
6+
import java.util.Set;
7+
import java.util.StringTokenizer;
8+
9+
public class BOJ_S4_1359_복권 {
10+
static int N, M, K, total, win;
11+
static int [] picks;
12+
static boolean [] v;
13+
static Set<Integer> set;
14+
15+
public static void main(String[] args) throws IOException {
16+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
17+
StringTokenizer st = new StringTokenizer(br.readLine());
18+
19+
N = Integer.parseInt(st.nextToken());
20+
M = Integer.parseInt(st.nextToken());
21+
K = Integer.parseInt(st.nextToken());
22+
23+
picks = new int[M];
24+
v = new boolean[N];
25+
set = new HashSet<>();
26+
27+
for (int i = 0; i < M; i++) {
28+
set.add(i);
29+
}
30+
31+
combi(0, 0);
32+
33+
double ans = 1.0 * win / total;
34+
35+
System.out.println(ans);
36+
37+
}
38+
39+
private static void combi(int start, int depth) {
40+
if(depth == M) {
41+
total++;
42+
43+
int cnt = 0;
44+
for (int i = 0; i < M; i++) {
45+
if(set.contains(picks[i])) cnt++;
46+
}
47+
48+
if(cnt >= K) win++;
49+
50+
return;
51+
}
52+
53+
for (int i = start; i < N; i++) {
54+
if(v[i]) continue;
55+
56+
v[i] = true;
57+
picks[depth] = i;
58+
combi(i+1, depth+1);
59+
v[i] = false;
60+
}
61+
62+
}
63+
}

0 commit comments

Comments
 (0)