結果

問題 No.1186 長方形の敷き詰め
ユーザー buey_tbuey_t
提出日時 2023-05-07 12:45:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,678 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 257,280 KB
最終ジャッジ日時 2024-05-03 13:04:04
合計ジャッジ時間 10,475 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 336 ms
257,152 KB
testcase_01 AC 326 ms
256,896 KB
testcase_02 AC 326 ms
257,152 KB
testcase_03 AC 331 ms
257,024 KB
testcase_04 AC 339 ms
256,896 KB
testcase_05 AC 339 ms
257,152 KB
testcase_06 AC 333 ms
256,896 KB
testcase_07 AC 336 ms
257,024 KB
testcase_08 AC 330 ms
257,152 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 334 ms
256,896 KB
testcase_12 AC 334 ms
257,280 KB
testcase_13 AC 336 ms
257,024 KB
testcase_14 AC 332 ms
257,024 KB
testcase_15 AC 349 ms
256,896 KB
testcase_16 AC 339 ms
257,152 KB
testcase_17 AC 331 ms
257,136 KB
testcase_18 AC 334 ms
257,024 KB
testcase_19 AC 339 ms
257,152 KB
testcase_20 AC 325 ms
257,024 KB
testcase_21 AC 336 ms
257,024 KB
testcase_22 AC 380 ms
257,084 KB
testcase_23 AC 335 ms
256,896 KB
testcase_24 AC 334 ms
256,896 KB
testcase_25 AC 329 ms
257,280 KB
testcase_26 AC 339 ms
256,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
from heapq import heapify, heappop, heappush
from bisect import bisect_left, bisect_right
from copy import deepcopy
import copy
import random
from random import randrange
from collections import deque,Counter,defaultdict
from itertools import permutations,combinations
from decimal import Decimal,ROUND_HALF_UP
#tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
from functools import lru_cache, reduce
#@lru_cache(maxsize=None)
from operator import add,sub,mul,xor,and_,or_,itemgetter
import sys
input = sys.stdin.readline
# .rstrip()
INF = 10**18
mod1 = 10**9+7
mod2 = 998244353

#DecimalならPython
#再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!!

#p = のところを変更すること。
#limitationも必要なら変更
def nCr(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = mod2
limitation = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, limitation + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''
縦にNってのがでかいな
MをNで何回割れるか的な
Mは小さかった

組み合わせちゃんと考えないとダメだ
'''

N,M = map(int, input().split())

if N == 1:
    print(M)
    exit()

now = N
ans = 1
while now <= M:
    ans += nCr(M-now+now//N,now//N,mod2)
    now += N
    ans %= mod2

print(ans)


























0