結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー jp_stejp_ste
提出日時 2020-04-13 05:17:47
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 30 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 39,296 KB
最終ジャッジ日時 2024-04-21 03:22:06
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
39,168 KB
testcase_01 AC 64 ms
39,296 KB
testcase_02 AC 61 ms
39,168 KB
testcase_03 AC 62 ms
39,296 KB
testcase_04 AC 62 ms
39,168 KB
testcase_05 AC 63 ms
39,040 KB
testcase_06 AC 62 ms
39,296 KB
testcase_07 AC 61 ms
39,040 KB
testcase_08 AC 62 ms
39,168 KB
testcase_09 AC 64 ms
39,296 KB
testcase_10 WA -
testcase_11 AC 63 ms
39,168 KB
testcase_12 AC 61 ms
39,168 KB
testcase_13 AC 61 ms
39,168 KB
testcase_14 AC 61 ms
39,168 KB
testcase_15 AC 63 ms
39,296 KB
testcase_16 AC 62 ms
39,040 KB
testcase_17 WA -
testcase_18 AC 60 ms
39,168 KB
testcase_19 AC 59 ms
39,168 KB
testcase_20 AC 59 ms
39,296 KB
testcase_21 AC 61 ms
39,296 KB
testcase_22 AC 64 ms
39,168 KB
testcase_23 AC 61 ms
39,040 KB
testcase_24 AC 61 ms
39,168 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 61 ms
39,168 KB
testcase_29 AC 61 ms
39,296 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();
	const left = str.substr(0, str.length - 10);
	const right = str.substr(-10);
	console.log(left + "." + right);
}

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