結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー tomarint2tomarint2
提出日時 2019-04-01 23:09:18
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 363 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 71,804 KB
最終ジャッジ日時 2023-08-18 02:14:49
合計ジャッジ時間 3,031 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,700 KB
testcase_01 AC 74 ms
71,644 KB
testcase_02 AC 74 ms
71,688 KB
testcase_03 AC 79 ms
71,620 KB
testcase_04 AC 74 ms
71,432 KB
testcase_05 AC 74 ms
71,528 KB
testcase_06 AC 73 ms
71,436 KB
testcase_07 AC 75 ms
71,536 KB
testcase_08 AC 73 ms
71,804 KB
testcase_09 AC 76 ms
71,572 KB
testcase_10 AC 76 ms
71,628 KB
testcase_11 AC 75 ms
71,744 KB
testcase_12 AC 75 ms
71,696 KB
testcase_13 AC 74 ms
71,532 KB
testcase_14 AC 74 ms
71,668 KB
testcase_15 AC 74 ms
71,744 KB
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(X):
    # a(n) = 6*a(n-1) - a(n-2) + 2 with a(0) = 0, a(1) = 3.
    A=[0,3]
    for i in range(2,30):
        A.append(6 * A[i-1] - A[i-2] + 2)
    #print(A)
    for a in A[1:]:
        b = a + 1
        c = int((a * a + b * b) ** 0.5)
        if len(str(c)) != X:
            continue
        return (a,b,c)

X=int(input())
a,b,c=solve(X)
print(a,b,c)
0