結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー neetprogrammerneetprogrammer
提出日時 2020-05-21 03:27:40
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 48,000 KB
最終ジャッジ日時 2024-04-21 03:38:43
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 67 ms
39,040 KB
testcase_02 AC 68 ms
39,040 KB
testcase_03 AC 74 ms
42,496 KB
testcase_04 AC 66 ms
43,008 KB
testcase_05 AC 76 ms
43,904 KB
testcase_06 AC 83 ms
44,032 KB
testcase_07 AC 373 ms
44,032 KB
testcase_08 AC 1,207 ms
44,032 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