結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー jp_stejp_ste
提出日時 2020-04-13 05:46:44
言語 JavaScript
(node v21.7.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 750 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 42,384 KB
最終ジャッジ日時 2023-09-25 16:22:34
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
42,008 KB
testcase_01 AC 77 ms
42,120 KB
testcase_02 AC 76 ms
42,160 KB
testcase_03 AC 77 ms
42,048 KB
testcase_04 AC 78 ms
42,308 KB
testcase_05 AC 77 ms
42,024 KB
testcase_06 AC 78 ms
42,144 KB
testcase_07 AC 77 ms
42,192 KB
testcase_08 AC 76 ms
42,232 KB
testcase_09 AC 77 ms
42,108 KB
testcase_10 WA -
testcase_11 AC 75 ms
42,136 KB
testcase_12 AC 78 ms
42,028 KB
testcase_13 AC 75 ms
42,036 KB
testcase_14 AC 76 ms
42,052 KB
testcase_15 AC 77 ms
42,224 KB
testcase_16 AC 76 ms
42,012 KB
testcase_17 AC 77 ms
42,252 KB
testcase_18 AC 77 ms
42,224 KB
testcase_19 AC 77 ms
42,384 KB
testcase_20 AC 77 ms
42,132 KB
testcase_21 AC 76 ms
42,212 KB
testcase_22 AC 77 ms
42,200 KB
testcase_23 AC 76 ms
42,192 KB
testcase_24 AC 77 ms
42,132 KB
testcase_25 AC 76 ms
42,264 KB
testcase_26 AC 77 ms
42,044 KB
testcase_27 AC 75 ms
42,004 KB
testcase_28 AC 76 ms
42,264 KB
testcase_29 AC 76 ms
42,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function main(input) {
	input = input.split("\n");
	const n = parseInt(input.shift());
	let ans = 0n;
	let sign = [];
	for(let i=0; i<n; i++) {
	    sign[i] = input[i][0] == '-' ? '-' : '+';
	    input[i] = input[i].indexOf('.') < 0 ? input[i] += "." : input[i];
	    const dotLeft = BigInt(input[i].substr(0, input[i].indexOf('.'))) * 10000000000n;
	    const dotRight = BigInt(sign[i] + input[i].substr(input[i].indexOf('.') + 1).padEnd(10, '0'));
	    ans += (dotLeft + dotRight);
	}
	const str = ans.toString();
	let left = str.substr(0, str.length - 10);
	if(left == '-' || left.length == 0) left += '0';
	const right = str.substr(-10).padEnd(10, '0');
	console.log(left + "." + right);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
0