結果
| 問題 | No.1593 Perfect Distance |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-17 17:56:41 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 2,000 ms |
| コード長 | 451 bytes |
| 記録 | |
| コンパイル時間 | 1,262 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-03-16 20:14:26 |
| 合計ジャッジ時間 | 4,458 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
from math import sqrt, floor
def main():
N = int(input())
patterns = 0
half = N ** 2 // 2
if N % 2 == 0:
if floor(sqrt(half)) ** 2 == half:
patterns += 1
print(floor(sqrt(half)))
for x in range(1, floor(sqrt(half)) + 1):
y_square = N ** 2 - x ** 2
if floor(sqrt(y_square)) ** 2 == y_square:
patterns += 2
print(patterns)
if __name__ == "__main__":
main()