結果
| 問題 |
No.8072 Sum of sqrt(x)
|
| ユーザー |
Kiri8128
|
| 提出日時 | 2020-09-13 23:32:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 473 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 283,180 KB |
| 最終ジャッジ日時 | 2024-06-13 04:42:30 |
| 合計ジャッジ時間 | 18,448 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 TLE * 4 -- * 17 |
ソースコード
def sqrt(n):
if not n: return 0
x = 1 << (n.bit_length() + 1) // 2
y = (x + n // x) // 2
while y < x:
x = y
y = (x + n // x) // 2
return x | 1
def tostr(n):
a, b = str(n // 10 ** 20), str(n % (10 ** 20)).zfill(20)
if len(a) > 15:
return a
return a + "." + b[:16 - len(a)]
N, *X = map(int, open(0).read().split())
s = 0
ANS = []
for x in X:
s += sqrt(x * 10 ** 40)
ANS.append(tostr(s))
print("\n".join(ANS))
Kiri8128