結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー neetprogrammerneetprogrammer
提出日時 2020-05-21 03:10:42
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 7,068 KB
実行使用メモリ 49,436 KB
最終ジャッジ日時 2024-04-21 03:37:56
合計ジャッジ時間 6,498 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

function f(a) {
  return (2 * (a * a)) + (2 * a) + 1
}

function check(a, c) {
  var b = (a + 1);
  var temp = (a * a) + (b * b);

  if (temp === (c * c))
    return true;
  return false;
}


function Main(input) {
  var loop = Math.pow(10, input);

  for (let i = 0; i < loop; i++) {
    var c = Math.sqrt(f(i));
    if (Number.isInteger(c)) {
      if (check(i, c)) {
        if (c.toString().length >= input) {
          console.log(i + ":" + (i + 1) + ":" + c);
          break;
        }
      }
    }
  }
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"))
0