結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー neetprogrammerneetprogrammer
提出日時 2020-05-25 03:40:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 538 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 82,544 KB
最終ジャッジ日時 2024-04-20 22:38:39
合計ジャッジ時間 6,789 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,580 KB
testcase_01 AC 35 ms
52,480 KB
testcase_02 AC 36 ms
51,968 KB
testcase_03 AC 39 ms
58,496 KB
testcase_04 AC 40 ms
58,880 KB
testcase_05 AC 40 ms
60,928 KB
testcase_06 AC 48 ms
71,296 KB
testcase_07 AC 300 ms
75,596 KB
testcase_08 AC 1,466 ms
75,136 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
import time


def f(a):
    return (2 * (a * a)) + (2 * a) + 1


def check(a, c):
    b = (a + 1)
    temp = (a * a) + (b * b)

    if temp == (c * c):
        return True
    return False


line = input()

digit = int(line)

start = 10 ** digit

for i in range(1, start):
    # for i in range(1, 10000000):
    c = sqrt(f(i))
    if c.is_integer():
        c = int(c)
        if check(i, c):
            if len(str(c)) == digit:
                print(str(i) + " " + str(i + 1) + " " + str(c))
                break
0