結果
問題 | No.2323 Nafmo、A+Bをする |
ユーザー | 辻和真 |
提出日時 | 2023-05-28 14:12:13 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 990 bytes |
コンパイル時間 | 316 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 39,296 KB |
最終ジャッジ日時 | 2024-12-26 23:57:54 |
合計ジャッジ時間 | 5,379 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
function Main(input){ input = input.trim() input = input.split("\n") input[0] = input[0].split("").map(Number) //console.log(input[0]) input[0] = input[0].reverse() input[1] = input[1].split("").map(Number).reverse() //console.log(input) //console.log(input[0]) len = Math.max(input[0].length,input[1].length) if(input[0].length<input[1].length){ while(input[0].length!== input[1].length){ input[0].push(0) //console.log("a") } }else{ while(input[0].length!== input[1].length){ input[1].push(0) } } //console.log(input,input[0].length<input[1].length) res = [] for(a = 0;a<len;a++){ if(input[0][a]+input[1][a] == 2){ res.push(0) }else{ res.push(input[0][a]+input[1][a]) } //console.log(res) } res = res.reverse() res = res.join("") res = parseInt(res,2) console.log(res) } Main(require("fs").readFileSync("/dev/stdin", "utf8"));