結果

問題 No.2323 Nafmo、A+Bをする
ユーザー 辻和真辻和真
提出日時 2023-05-28 14:12:13
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 990 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 5,344 KB
実行使用メモリ 42,140 KB
最終ジャッジ日時 2023-08-27 09:13:46
合計ジャッジ時間 3,573 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
41,820 KB
testcase_01 AC 76 ms
41,936 KB
testcase_02 AC 76 ms
42,128 KB
testcase_03 AC 77 ms
42,092 KB
testcase_04 AC 77 ms
41,972 KB
testcase_05 AC 76 ms
42,016 KB
testcase_06 AC 76 ms
41,824 KB
testcase_07 AC 76 ms
42,076 KB
testcase_08 AC 77 ms
42,140 KB
testcase_09 AC 77 ms
41,824 KB
testcase_10 AC 77 ms
42,068 KB
testcase_11 AC 77 ms
41,972 KB
testcase_12 AC 77 ms
41,848 KB
testcase_13 AC 76 ms
41,980 KB
testcase_14 AC 77 ms
41,812 KB
testcase_15 AC 77 ms
42,096 KB
testcase_16 AC 77 ms
41,824 KB
testcase_17 AC 76 ms
42,024 KB
testcase_18 AC 76 ms
41,976 KB
testcase_19 AC 77 ms
41,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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"));
0