結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 80 ms
41,860 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 80 ms
41,892 KB
testcase_07 AC 81 ms
41,896 KB
testcase_08 AC 80 ms
41,912 KB
testcase_09 AC 80 ms
41,828 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = Number(res)
  console.log(res)
  
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0