結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2019-03-17 23:39:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 290 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 134 ms |
コンパイル使用メモリ | 81,644 KB |
実行使用メモリ | 203,444 KB |
最終ジャッジ日時 | 2024-07-08 06:11:07 |
合計ジャッジ時間 | 5,512 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
N, D = [int(i) for i in input().split()] count1 = [0] * (2 * N * N + 1 + D) for x in range(1, N + 1): for y in range(1, N + 1): count1[x * x + y * y] += 1 count2 = [0] * (2 * N * N + 1 + D) for w in range(1, N + 1): for z in range(1, N + 1): temp = w * w - z * z + D if 0 <= temp: count2[w * w - z * z + D] += 1 result = 0 for c1, c2 in zip(count1, count2): result += c1 * c2 print(result)