Skip to content

Commit 321533a

Browse files
authored
[20250303] BOJ / G3 / 울타리 치기 / 권혁준
1 parent 02e7c6c commit 321533a

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
```java
2+
3+
import java.util.*;
4+
import java.io.*;
5+
6+
7+
class Main {
8+
9+
// IO field
10+
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11+
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
12+
static StringTokenizer st;
13+
14+
static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());}
15+
static int nextInt() {return Integer.parseInt(st.nextToken());}
16+
static long nextLong() {return Long.parseLong(st.nextToken());}
17+
static void bwEnd() throws Exception {bw.flush();bw.close();}
18+
19+
// Additional field
20+
static long[] D;
21+
static int N;
22+
23+
public static void main(String[] args) throws Exception {
24+
25+
ready();
26+
solve();
27+
28+
bwEnd();
29+
30+
}
31+
32+
static void ready() throws Exception{
33+
34+
N = Integer.parseInt(br.readLine());
35+
D = new long[1000001];
36+
37+
}
38+
39+
static void solve() throws Exception{
40+
41+
for(int i=1;i<=5;i++) D[i] = i;
42+
D[6] = 7;
43+
for(int i=7;i<=N;i++) D[i] = D[i-6] + i;
44+
bw.write(D[N] + "\n");
45+
46+
}
47+
48+
}
49+
50+
```

0 commit comments

Comments
 (0)