結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー neetprogrammerneetprogrammer
提出日時 2020-05-25 03:39:07
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 43,648 KB
最終ジャッジ日時 2024-04-21 02:50:15
合計ジャッジ時間 6,077 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 57 ms
38,656 KB
testcase_02 AC 60 ms
38,656 KB
testcase_03 AC 64 ms
42,240 KB
testcase_04 AC 67 ms
42,752 KB
testcase_05 AC 72 ms
43,648 KB
testcase_06 AC 83 ms
43,520 KB
testcase_07 AC 366 ms
43,392 KB
testcase_08 AC 1,165 ms
43,392 KB
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, parseInt(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