結果

問題 No.1184 Hà Nội
ユーザー IchimiyaIchimiya
提出日時 2021-06-07 00:37:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 167,528 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-23 22:11:13
合計ジャッジ時間 2,427 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define NIL (-1)
#define ll long long
using namespace std;
const double PI = acos(-1.0);

int main() {
	ll N, L;
	cin >> N >> L;

	ll n = N / L;
	n += N % L;
	if (N < L) n = 1;

	const ll mod = 998244353;
	ll ans = 1, m = 2;
	while (n) {
		if (n & 1) {
			ans *= m;
			n--;
		}
		m *= 2;
		ans %= mod;
		m %= mod;
		n /= 2;
	}
	cout << ans - 1 << endl;

	return 0;
}
0