-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_2292.java
More file actions
36 lines (31 loc) ยท 772 Bytes
/
_2292.java
File metadata and controls
36 lines (31 loc) ยท 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package backjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
// https://www.acmicpc.net/problem/2292
// ๋ฒ์ง
public class _2292 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// memory 11448 runtime 76
int N = Integer.parseInt(br.readLine());
int cnt = 1;
int range = 2; // ๋ค์ ์ค๋ก ๋์ด๊ฐ๋ ๋ฒ์ง์ ๋ฒ์ (์ต์๊ฐ ๊ธฐ์ค)
if (N == 1) {
System.out.print(1);
} else {
while (range <= N) {
// ๋ฐฉ์ ๋ฒ์๋ 6์ ๋ฐฐ์๋ผ์ (6 * cnt)์
range = range + (6 * cnt);
cnt++;
}
System.out.print(cnt);
}
}
}
/*
input
13
output
3
*/