結果
| 問題 | No.864 四方演算 |
| コンテスト | |
| ユーザー |
ayaoni
|
| 提出日時 | 2020-12-11 00:46:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 1,000 ms |
| コード長 | 812 bytes |
| 記録 | |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 58,752 KB |
| 最終ジャッジ日時 | 2024-09-19 21:00:04 |
| 合計ジャッジ時間 | 2,542 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())
N,K = I(),I()
def f(x): # a+b == x (1 <= a,b <= N) の解の個数
if x <= 1 or x >= 2*N+1:
return 0
if 2 <= x <= N+1:
return x-1
else:
return 2*N+1-x
ans = 0
for d in range(1,int(K**.5)+1):
if K % d == 0:
if d == K//d:
ans += f(d)**2
else:
ans += 2*f(d)*f(K//d)
print(ans)
ayaoni