結果

問題 No.1186 長方形の敷き詰め
ユーザー cn_449cn_449
提出日時 2020-08-22 13:19:02
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 1,557 bytes
コンパイル時間 1,476 ms
コンパイル使用メモリ 130,652 KB
実行使用メモリ 11,012 KB
最終ジャッジ日時 2024-04-23 07:41:34
合計ジャッジ時間 2,373 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 5 ms
11,012 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 4 ms
6,940 KB
testcase_18 AC 4 ms
8,284 KB
testcase_19 AC 5 ms
9,268 KB
testcase_20 AC 5 ms
9,928 KB
testcase_21 AC 5 ms
7,928 KB
testcase_22 AC 8 ms
10,964 KB
testcase_23 AC 6 ms
7,600 KB
testcase_24 AC 6 ms
10,056 KB
testcase_25 AC 5 ms
7,432 KB
testcase_26 AC 4 ms
8,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 998244353;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ll n, m;
	cin >> n >> m;
	if (n == 1) {
		cout << "1\n";
		return 0;
	}
	vector<ll> dp(m + 1);
	dp[0] = 1;
	for (int i = 1; i <= m; i++) {
		dp[i] = dp[i - 1];
		if (i >= n) {
			dp[i] += dp[i - n];
			if (dp[i] >= mod) dp[i] -= mod;
		}
	}
	cout << dp[m] << '\n';
}
0