結果

問題 No.58 イカサマなサイコロ
ユーザー holegumaholeguma
提出日時 2015-08-12 01:52:41
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 801 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 74,428 KB
実行使用メモリ 50,696 KB
最終ジャッジ日時 2023-09-25 08:18:55
合計ジャッジ時間 3,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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.00");
BigDecimal a=new BigDecimal("5.00");
BigDecimal b=new BigDecimal("12.00");
BigDecimal c=new BigDecimal("2.00");
BigDecimal d=new BigDecimal("3.00");
for(int i=0;i<n;i++){
ans=ans.multiply(a).divide(b);
}
for(int i=0;i<k;i++){
ans=ans.multiply(c).divide(d);
}
ans=ans.setScale(5,RoundingMode.HALF_UP);
out.println(ans);
out.flush();
}
}
}
0