結果
問題 | No.864 四方演算 |
ユーザー |
|
提出日時 | 2020-05-19 01:45:46 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 134 ms / 1,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-01 22:24:32 |
合計ジャッジ時間 | 3,844 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) divisors.append(n // i) return divisors n = int(readline()) k = int(readline()) k = make_divisors(k) ans = 0 for x, y in zip(k[::2], k[1::2]): xx = x - 1 if n >= x else 2 * n + 1 - x yy = y - 1 if n >= y else 2 * n + 1 - y xy = xx * yy if xy >= 0: if x != y: xy *= 2 ans += xy print(ans)