結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー ぴろずぴろず
提出日時 2014-12-05 11:05:29
言語 Java19
(openjdk 21)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 546 bytes
コンパイル時間 2,345 ms
コンパイル使用メモリ 82,000 KB
実行使用メモリ 40,424 KB
最終ジャッジ日時 2023-09-29 22:27:24
合計ジャッジ時間 7,795 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
40,036 KB
testcase_01 AC 136 ms
39,520 KB
testcase_02 AC 132 ms
39,984 KB
testcase_03 AC 128 ms
40,016 KB
testcase_04 AC 138 ms
39,824 KB
testcase_05 AC 135 ms
39,928 KB
testcase_06 AC 139 ms
39,904 KB
testcase_07 AC 142 ms
40,424 KB
testcase_08 AC 141 ms
40,220 KB
testcase_09 AC 144 ms
39,576 KB
testcase_10 AC 131 ms
40,024 KB
testcase_11 AC 134 ms
40,064 KB
testcase_12 AC 135 ms
39,524 KB
testcase_13 AC 131 ms
39,952 KB
testcase_14 AC 131 ms
39,464 KB
testcase_15 AC 139 ms
39,892 KB
testcase_16 AC 131 ms
39,564 KB
testcase_17 AC 134 ms
39,588 KB
testcase_18 AC 145 ms
39,952 KB
testcase_19 AC 138 ms
39,524 KB
testcase_20 AC 133 ms
39,488 KB
testcase_21 AC 134 ms
39,944 KB
testcase_22 AC 135 ms
39,660 KB
testcase_23 AC 139 ms
40,168 KB
testcase_24 AC 137 ms
39,468 KB
testcase_25 AC 134 ms
40,072 KB
testcase_26 AC 129 ms
39,740 KB
testcase_27 AC 132 ms
39,396 KB
testcase_28 AC 131 ms
39,924 KB
testcase_29 AC 137 ms
40,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no81;

import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		BigDecimal sum = BigDecimal.ZERO;
		for(int i=0;i<n;i++) {
			sum = sum.add(new BigDecimal(sc.next()));
		}
		String s = sum.toPlainString();
		if (s.indexOf('.') >= 0) {
			System.out.println(s + ("0000000000".substring(Math.min(10,-s.indexOf('.')+s.length()-1))));
		}else{
			System.out.println(s + ".0000000000");
		}
	}
}
0