We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3cd0fd1 + 5e79063 commit 19b8b2dCopy full SHA for 19b8b2d
lkhyun/202502/12 BOJ 골드4 주사위 게임.md
@@ -0,0 +1,23 @@
1
+```java
2
+import java.io.*;
3
+public class Main{
4
+ public static void main(String[] args) throws Exception{
5
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
6
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
7
+ int N = Integer.parseInt(br.readLine());
8
+
9
+ double[] expectation = new double[N+1];
10
11
+ for(int i=1;i<=N;i++){
12
+ for(int k=1;k<=6;k++){
13
+ if(i-k >=0){
14
+ expectation[i] += expectation[i-k];
15
+ }
16
17
+ expectation[i] = 1+(expectation[i]/6);
18
19
+ bw.write(expectation[N]+"");
20
+ bw.flush();
21
22
+}
23
+```
0 commit comments