結果
| 問題 |
No.1952 xooooooooooor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-21 00:05:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 369 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-20 10:30:00 |
| 合計ジャッジ時間 | 2,352 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 39 |
ソースコード
n, m = map(int, input().split())
D = [0 for _ in range(31)]
q = n
for i in range(31):
q, r = divmod(q, 2)
D[i] = r
mod = 998244353
ans = 0
res = 0
for i in range(31):
res += D[i]
if i >= m:
res -= D[i - m]
res %= 2
ans += res * pow(2, i, mod)
ans %= mod
if m > 30:
ans += res * (pow(2, m, mod) - pow(2, 31, mod)) % mod
ans %= mod
for i in range(31):
res -= D[i]
res %= 2
ans += res * pow(2, m + i, mod)
ans %= mod
else:
for i in range(31 - m, 31):
res -= D[i]
res %= 2
ans += res * pow(2, i + 30, mod)
ans %= mod
print(ans)