結果

問題 No.1186 長方形の敷き詰め
ユーザー buey_tbuey_t
提出日時 2023-05-07 12:45:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,678 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 257,624 KB
最終ジャッジ日時 2023-08-16 03:31:59
合計ジャッジ時間 12,895 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 397 ms
257,164 KB
testcase_01 AC 378 ms
257,312 KB
testcase_02 AC 382 ms
257,124 KB
testcase_03 AC 378 ms
257,216 KB
testcase_04 AC 375 ms
257,232 KB
testcase_05 AC 377 ms
257,452 KB
testcase_06 AC 374 ms
256,980 KB
testcase_07 AC 390 ms
257,172 KB
testcase_08 AC 380 ms
256,972 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 380 ms
257,356 KB
testcase_12 AC 393 ms
257,228 KB
testcase_13 AC 381 ms
257,208 KB
testcase_14 AC 390 ms
257,240 KB
testcase_15 AC 388 ms
257,556 KB
testcase_16 AC 387 ms
257,104 KB
testcase_17 AC 396 ms
257,624 KB
testcase_18 AC 389 ms
257,396 KB
testcase_19 AC 380 ms
257,408 KB
testcase_20 AC 377 ms
257,236 KB
testcase_21 AC 381 ms
257,404 KB
testcase_22 AC 427 ms
257,204 KB
testcase_23 AC 388 ms
257,116 KB
testcase_24 AC 386 ms
257,428 KB
testcase_25 AC 388 ms
257,372 KB
testcase_26 AC 381 ms
257,172 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