結果
| 問題 |
No.864 四方演算
|
| ユーザー |
|
| 提出日時 | 2021-02-16 01:50:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 1,000 ms |
| コード長 | 683 bytes |
| コンパイル時間 | 365 ms |
| コンパイル使用メモリ | 82,784 KB |
| 実行使用メモリ | 62,512 KB |
| 最終ジャッジ日時 | 2024-07-23 17:21:38 |
| 合計ジャッジ時間 | 2,799 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
def check_pattern(n,p):
if 2 <= p <= n+1:
num = p-1
elif n+2 <= p <= 2*n:
num = 2*n+1-p
else:
num = 0
return num
N,K = int(input()),int(input())
l = list(filter(lambda x: x <= 2*N, make_divisors(K)))
count = 0
for i in l:
for j in l:
if i*j == K:
count += check_pattern(N,i)*check_pattern(N,j)
break
print(count)