結果

問題 No.49 算数の宿題
コンテスト
ユーザー anta
提出日時 2014-10-23 23:10:35
言語 JavaScript
(node v25.8.2)
コンパイル:
true
実行:
node _filename_ ONLINE_JUDGE
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 404 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 195 ms
コンパイル使用メモリ 6,656 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2026-05-29 04:29:09
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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