結果

問題 No.49 算数の宿題
ユーザー antaanta
提出日時 2014-10-23 23:10:35
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 30 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 42,440 KB
最終ジャッジ日時 2023-08-24 17:22:46
合計ジャッジ時間 1,801 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
42,132 KB
testcase_01 AC 74 ms
42,092 KB
testcase_02 AC 74 ms
41,996 KB
testcase_03 AC 75 ms
42,424 KB
testcase_04 AC 73 ms
42,092 KB
testcase_05 AC 76 ms
42,136 KB
testcase_06 AC 76 ms
42,440 KB
testcase_07 AC 74 ms
42,080 KB
testcase_08 AC 74 ms
42,020 KB
testcase_09 AC 76 ms
42,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	var s = input.replace(/([\*\+])/g, ')$1');
	s = s.replace(/[^\)]/g, '').replace(/\)/g, '(') + s;
	s = s.replace(/\+/g, 'a').replace(/\*/g, '+').replace(/a/g, '*');
	console.log('%d', eval(s));
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0