結果

問題 No.858 わり算
ユーザー watarimaycry2
提出日時 2019-08-12 22:49:25
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 44,196 KB
最終ジャッジ日時 2025-01-07 14:50:46
合計ジャッジ時間 3,791 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
  var A = parseInt(input.split(" ")[0]);
  var B = parseInt(input.split(" ")[1]);
  if(A % B == 0){
    console.log(A/B + ".00000000000000000000000000000000000000000000000000");
  }else{
      var output = "";
      for(var i = 0; i < 51; i++){
          output += Math.floor(A/B).toString();
          if(i == 0){
              output += ".";
          }
          A = (A % B) * 10;
      }
      console.log(output);
  }
}

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