結果
問題 | No.1593 Perfect Distance |
ユーザー | SidewaysOwl |
提出日時 | 2021-07-09 21:53:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 249 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 98,304 KB |
最終ジャッジ日時 | 2024-07-01 16:12:28 |
合計ジャッジ時間 | 2,136 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
from collections import defaultdict ans = 0 n = int(input()) d = defaultdict(int) l = [0] * n for i in range(1,n): d[i**2] += 1 l[i] = i ** 2 ans = 0 for i in range(1,n): find = n ** 2 - l[i] if find in d: ans += 1 print(ans)