-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboj2018.java
More file actions
27 lines (24 loc) · 735 Bytes
/
boj2018.java
File metadata and controls
27 lines (24 loc) · 735 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class boj2018 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int cnt = 1;
for (int i = 1; i < (N / 2) + 1; i++) {
int sum = i;
for (int j = i + 1; i < (N / 2) + 2; j++) {
if (sum == N) {
cnt++;
break;
}
if (sum > N) {
break;
}
sum += j;
}
}
System.out.println(cnt);
}
}