From 5e79063fe45e9154212fe7dc2de07e58add77b2d Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:59:10 +0900 Subject: [PATCH] =?UTF-8?q?[20250212]=20BOJ=20/=20=EA=B3=A8=EB=93=9C4=20/?= =?UTF-8?q?=20=EC=A3=BC=EC=82=AC=EC=9C=84=20=EA=B2=8C=EC=9E=84=20/=20?= =?UTF-8?q?=EC=9D=B4=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\354\234\204 \352\262\214\354\236\204.md" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "lkhyun/202502/12 BOJ \352\263\250\353\223\2344 \354\243\274\354\202\254\354\234\204 \352\262\214\354\236\204.md" diff --git "a/lkhyun/202502/12 BOJ \352\263\250\353\223\2344 \354\243\274\354\202\254\354\234\204 \352\262\214\354\236\204.md" "b/lkhyun/202502/12 BOJ \352\263\250\353\223\2344 \354\243\274\354\202\254\354\234\204 \352\262\214\354\236\204.md" new file mode 100644 index 00000000..16a10890 --- /dev/null +++ "b/lkhyun/202502/12 BOJ \352\263\250\353\223\2344 \354\243\274\354\202\254\354\234\204 \352\262\214\354\236\204.md" @@ -0,0 +1,23 @@ +```java +import java.io.*; +public class Main{ + public static void main(String[] args) throws Exception{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + int N = Integer.parseInt(br.readLine()); + + double[] expectation = new double[N+1]; + + for(int i=1;i<=N;i++){ + for(int k=1;k<=6;k++){ + if(i-k >=0){ + expectation[i] += expectation[i-k]; + } + } + expectation[i] = 1+(expectation[i]/6); + } + bw.write(expectation[N]+""); + bw.flush(); + } +} +```