結果
| 問題 | No.1593 Perfect Distance | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-10-17 17:56:41 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 90 ms / 2,000 ms | 
| コード長 | 451 bytes | 
| コンパイル時間 | 243 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-06-28 08:05:16 | 
| 合計ジャッジ時間 | 2,099 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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()
            
            
            
        