結果

問題 No.1186 長方形の敷き詰め
ユーザー buey_tbuey_t
提出日時 2023-05-07 12:32:45
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 1,642 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 257,612 KB
最終ジャッジ日時 2023-08-16 03:25:38
合計ジャッジ時間 13,674 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 406 ms
257,336 KB
testcase_01 AC 407 ms
257,348 KB
testcase_02 AC 408 ms
257,148 KB
testcase_03 AC 402 ms
257,404 KB
testcase_04 AC 405 ms
257,276 KB
testcase_05 AC 401 ms
257,304 KB
testcase_06 AC 409 ms
257,356 KB
testcase_07 AC 409 ms
257,200 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 398 ms
257,312 KB
testcase_12 AC 391 ms
257,128 KB
testcase_13 AC 395 ms
257,416 KB
testcase_14 AC 393 ms
257,216 KB
testcase_15 AC 400 ms
257,216 KB
testcase_16 AC 389 ms
257,572 KB
testcase_17 AC 390 ms
257,464 KB
testcase_18 AC 391 ms
257,520 KB
testcase_19 AC 390 ms
257,472 KB
testcase_20 AC 397 ms
257,480 KB
testcase_21 AC 391 ms
257,612 KB
testcase_22 AC 431 ms
257,396 KB
testcase_23 AC 388 ms
257,132 KB
testcase_24 AC 386 ms
257,328 KB
testcase_25 AC 398 ms
257,204 KB
testcase_26 AC 396 ms
257,272 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())

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

print(ans)


























0