結果
問題 | No.58 イカサマなサイコロ |
ユーザー | holeguma |
提出日時 | 2015-08-12 02:02:23 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 893 bytes |
コンパイル時間 | 1,948 ms |
コンパイル使用メモリ | 78,180 KB |
実行使用メモリ | 50,544 KB |
最終ジャッジ日時 | 2023-09-25 08:19:15 |
合計ジャッジ時間 | 3,058 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 45 ms
49,868 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
ソースコード
import java.io.*; import java.math.BigDecimal; import java.math.RoundingMode; class Main{ static final PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine())!=null&&!line.isEmpty()){ int n=Integer.parseInt(line); int k=Integer.parseInt(br.readLine()); n-=k; BigDecimal ans=new BigDecimal("1.000000"); BigDecimal a=new BigDecimal("5.000000"); BigDecimal b=new BigDecimal("12.000000"); BigDecimal c=new BigDecimal("2.000000"); BigDecimal d=new BigDecimal("3.000000"); if(n!=0){ for(int i=0;i<n;i++){ ans=ans.multiply(a).divide(b,20,RoundingMode.HALF_UP); } } if(k!=0){ for(int i=0;i<k;i++){ ans=ans.multiply(c).divide(d,20,RoundingMode.HALF_UP); } } ans=ans.setScale(5,RoundingMode.HALF_UP); out.println(ans); out.flush(); } } }