結果

問題 No.84 悪の算盤
ユーザー kou6839kou6839
提出日時 2014-12-04 11:46:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 670 bytes
コンパイル時間 2,476 ms
コンパイル使用メモリ 72,428 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-08-03 12:02:16
合計ジャッジ時間 4,888 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,776 KB
testcase_01 AC 119 ms
56,200 KB
testcase_02 AC 116 ms
55,952 KB
testcase_03 AC 117 ms
55,852 KB
testcase_04 AC 119 ms
56,056 KB
testcase_05 AC 118 ms
55,880 KB
testcase_06 AC 118 ms
55,812 KB
testcase_07 AC 119 ms
55,576 KB
testcase_08 AC 119 ms
55,776 KB
testcase_09 AC 119 ms
56,048 KB
testcase_10 AC 119 ms
55,488 KB
testcase_11 AC 117 ms
55,772 KB
testcase_12 AC 118 ms
55,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n=sc.next();
		String k=sc.next();
		if(n.equals(k)){
			BigDecimal a = new BigDecimal(n);
			BigDecimal b = new BigDecimal(k);

			a = a.multiply(b);
			a=a.divide(new BigDecimal(4),0,BigDecimal.ROUND_CEILING);
			System.out.println(a.subtract(new BigDecimal(1)));
		}else{
		BigDecimal a = new BigDecimal(n);
		BigDecimal b = new BigDecimal(k);
		a = a.multiply(b);
		a=a.divide(new BigDecimal(2),0,BigDecimal.ROUND_CEILING);
		System.out.println(a.subtract(new BigDecimal(1)));
		}
		
	}
}	
0