結果
問題 | No.8054 ほぼ直角二等辺三角形 |
ユーザー | tomarint2 |
提出日時 | 2019-04-01 23:24:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 139 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 374 ms |
コンパイル使用メモリ | 82,472 KB |
実行使用メモリ | 80,256 KB |
最終ジャッジ日時 | 2024-11-27 04:36:53 |
合計ジャッジ時間 | 4,427 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
import decimal decimal.getcontext().prec = 30 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 c2 = decimal.Decimal(a * a + b * b) p = decimal.Decimal('0.5') c = pow(c2, p) c = str(c) c = c[:c.index('.')] if len(str(c)) != X: continue return (a,b,c) X=int(input()) #for X in range(1,20): a,b,c=solve(X) print(a,b,c)