結果

問題 No.1186 長方形の敷き詰め
ユーザー flippergoflippergo
提出日時 2021-01-03 14:54:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 91,392 KB
最終ジャッジ日時 2024-04-21 09:34:00
合計ジャッジ時間 3,510 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
74,752 KB
testcase_01 AC 72 ms
75,136 KB
testcase_02 AC 71 ms
74,880 KB
testcase_03 AC 72 ms
74,752 KB
testcase_04 AC 71 ms
74,752 KB
testcase_05 AC 71 ms
74,880 KB
testcase_06 AC 71 ms
74,752 KB
testcase_07 AC 72 ms
74,880 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 71 ms
74,624 KB
testcase_12 AC 72 ms
74,752 KB
testcase_13 AC 72 ms
75,136 KB
testcase_14 AC 73 ms
75,136 KB
testcase_15 AC 71 ms
74,880 KB
testcase_16 AC 71 ms
75,136 KB
testcase_17 AC 71 ms
74,624 KB
testcase_18 AC 70 ms
74,880 KB
testcase_19 AC 72 ms
74,624 KB
testcase_20 AC 71 ms
74,752 KB
testcase_21 AC 69 ms
74,880 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 71 ms
74,880 KB
testcase_25 AC 72 ms
74,752 KB
testcase_26 AC 71 ms
75,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p = 998244353
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
A = [1 for _ in range(10**6+1)]
for i in range(2,10**6+1):
    A[i] = (A[i-1]*i)%p
B = [1 for _ in range(10**6+1)]
B[10**6] = pow(A[10**6],p-2)
for i in range(10**6-1,1,-1):
    B[i] = (B[i+1]*(i+1))%p
def f(n,k):
    if k>n or k<0:
        return 0
    if k==n or k==0:
        return 1
    return (A[n]*B[k]*B[n-k])%p
N,M = map(int,input().split())
if N>M:
    print(1)
else:
    m = M//N
    k = M%N
    cnt = 0
    for i in range(m+1):
        cnt += f((m-i)*N+k+i,i)
    print(cnt)
0