結果
| 問題 |
No.1593 Perfect Distance
|
| コンテスト | |
| ユーザー |
Kiri8128
|
| 提出日時 | 2021-07-09 22:49:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 319 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,240 KB |
| 実行使用メモリ | 75,892 KB |
| 最終ジャッジ日時 | 2024-07-01 17:59:02 |
| 合計ジャッジ時間 | 1,928 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
# C
def sqrt(n):
if n == 0: 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
n = int(input())
N = n ** 2
ans = 0
for x in range(1, n):
a = sqrt(N - x * x)
if x ** 2 + a ** 2 == N:
ans += 1
print(ans)
Kiri8128