File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 216
216
| 24 | | [ Baekjoon-11054 ๊ฐ์ฅ ๊ธด ๋ฐ์ดํ ๋ ๋ถ๋ถ ์์ด] ( src/DP/P11054 ) | |
217
217
| 25 | | [ Baekjoon-1912 ์ฐ์ํฉ] ( src/DP/P1912 ) | |
218
218
| 26 | | [ Baekjoon-13398 ์ฐ์ํฉ 2] ( src/DP/P13398 ) | |
219
+ | 27 | | [ Baekjoon-1699 ์ ๊ณฑ์์ ํฉ] ( src/DP/P1699 ) | |
219
220
220
221
---
221
222
Original file line number Diff line number Diff line change
1
+ package DP .P1699 ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class Main {
6
+
7
+ static int N ;
8
+ static int [] dp = new int [100001 ];
9
+
10
+ public static void main (String [] args ) {
11
+ Scanner sc = new Scanner (System .in );
12
+ N = sc .nextInt ();
13
+
14
+ for (int i = 1 ; i <= N ; i ++) {
15
+ int nearSquare = (int ) Math .floor (Math .sqrt (i ));
16
+ dp [i ] = Integer .MAX_VALUE ;
17
+ for (int j = nearSquare ; j > 0 ; j --) {
18
+ dp [i ] = Math .min (dp [i ], dp [i - j *j ] + 1 );
19
+ }
20
+ }
21
+
22
+ System .out .println (dp [N ]);
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ ## [ baekjoon-1699] ์ ๊ณฑ์์ ํฉ
2
+
3
+ ![ image] ( https://user-images.githubusercontent.com/22045163/100987220-93bb7c80-3591-11eb-92e7-8e5456b8bb8f.png )
4
+
5
+ ![ IMG_F93DDD89E4EC-1] ( https://user-images.githubusercontent.com/22045163/100987439-dda46280-3591-11eb-8ca2-2a7e91d23c83.jpeg )
You canโt perform that action at this time.
0 commit comments