8000 Merge pull request #68 from hehehwang/master · SungKweon/basic-algo-lecture@66a967f · GitHub
[go: up one dir, main page]

Skip to content

Commit 66a967f

Browse files
Merge pull request encrypted-def#68 from hehehwang/master
Update 9020.cpp
2 parents 68f12a8 + bf7dc6a commit 66a967f

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

0x12/solutions/9020.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
// Authored by : BaaaaaaaaaaarkingDog
1+
// Authored by : heheHwang
22
// Co-authored by : -
3-
// http://boj.kr/****************
3+
// http://boj.kr/1bfaf1e6669d4f82ab09af60d6897020
44
#include <bits/stdc++.h>
55
using namespace std;
66

7-
int main(void){
7+
const int MXN = 10'002;
8+
vector<bool> seive(MXN, 1);
9+
int main(void) {
810
ios::sync_with_stdio(0);
911
cin.tie(0);
10-
12+
13+
for (int i = 2; i*i < MXN ; i++){
14+
if (!seive[i]) continue;
15+
for (int j = i * i; j <= MXN; j += i) seive[j] = false;
16+
}
17+
18+
int tc;
19+
cin >> tc;
20+
for (int i = 0; i < tc; i++) {
21+
int c;
22+
cin >> c;
23+
for (int a = c/2; 0 < a; a--){
24+
int b = c - a;
25+
if (seive[a] && seive[b]){
26+
cout << a << ' ' << b << '\n';
27+
break;
28+
}
29+
}
30+
}
1131
}

workbook/0x12.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 수학
22

3-
![100%](https://progress-bar.dev/8/?scale=38&title=progress&width=500&color=babaca&suffix=/38)
3+
![100%](https://progress-bar.dev/9/?scale=38&title=progress&width=500&color=babaca&suffix=/38)
44

55
[문제집 링크](https://www.acmicpc.net/workbook/view/8174)
66

@@ -22,7 +22,7 @@
2222
| 1011 | [Fly me to the Alpha Centauri](https://www.acmicpc.net/problem/1011) | - |
2323
| 4948 | [베르트랑 공준](https://www.acmicpc.net/problem/4948) | - |
2424
| 1456 | [거의 소수](https://www.acmicpc.net/problem/1456) | - |
25-
| 9020 | [골드바흐의 추측](https://www.acmicpc.net/problem/9020) | - |
25+
| 9020 | [골드바흐의 추측](https://www.acmicpc.net/problem/9020) | [정답 코드](../0x12/solutions/9020.cpp) |
2626
| 1476 | [날짜 계산](https://www.acmicpc.net/problem/1476) | - |
2727
| 1676 | [팩토리얼 0의 개수](https://www.acmicpc.net/problem/1676) | - |
2828
| 10610 | [30](https://www.acmicpc.net/problem/10610) | - |

0 commit comments

Comments
 (0)
0