File tree 2 files changed +26
-6
lines changed 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 1
- // Authored by : BaaaaaaaaaaarkingDog
1
+ // Authored by : heheHwang
2
2
// Co-authored by : -
3
- // http://boj.kr/****************
3
+ // http://boj.kr/1bfaf1e6669d4f82ab09af60d6897020
4
4
#include < bits/stdc++.h>
5
5
using namespace std ;
6
6
7
- int main (void ){
7
+ const int MXN = 10'002 ;
8
+ vector<bool > seive (MXN, 1 );
9
+ int main (void ) {
8
10
ios::sync_with_stdio (0 );
9
11
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
+ }
11
31
}
Original file line number Diff line number Diff line change 1
1
# 수학
2
2
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 )
4
4
5
5
[ 문제집 링크] ( https://www.acmicpc.net/workbook/view/8174 )
6
6
22
22
| 1011 | [ Fly me to the Alpha Centauri] ( https://www.acmicpc.net/problem/1011 ) | - |
23
23
| 4948 | [ 베르트랑 공준] ( https://www.acmicpc.net/problem/4948 ) | - |
24
24
| 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 ) |
26
26
| 1476 | [ 날짜 계산] ( https://www.acmicpc.net/problem/1476 ) | - |
27
27
| 1676 | [ 팩토리얼 0의 개수] ( https://www.acmicpc.net/problem/1676 ) | - |
28
28
| 10610 | [ 30] ( https://www.acmicpc.net/problem/10610 ) | - |
You can’t perform that action at this time.
0 commit comments