結果

問題 No.2323 Nafmo、A+Bをする
ユーザー 辻和真
提出日時 2023-05-28 14:09:59
言語 JavaScript
(node v23.5.0)
結果
WA  
実行時間 -
コード長 986 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 39,552 KB
最終ジャッジ日時 2024-12-26 23:44:52
合計ジャッジ時間 3,632 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 4 WA * 13
権限があれば一括ダウンロードができます

ソースコード

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