結果
問題 |
No.49 算数の宿題
|
ユーザー |
![]() |
提出日時 | 2014-10-23 23:10:35 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 66 ms / 5,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 320 ms |
コンパイル使用メモリ | 7,076 KB |
実行使用メモリ | 39,296 KB |
最終ジャッジ日時 | 2024-12-23 01:41:49 |
合計ジャッジ時間 | 1,728 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
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"));