結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-26 06:55:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 226 ms / 5,000 ms |
| コード長 | 1,362 bytes |
| コンパイル時間 | 1,263 ms |
| コンパイル使用メモリ | 127,048 KB |
| 最終ジャッジ日時 | 2025-01-17 07:28:16 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;
template<class T>
inline bool chmax(T& x, T y){
if(x < y){
x = y;
return true;
}
return false;
}
template<class T>
inline bool chmin(T& x, T y){
if(x > y){
x = y;
return true;
}
return false;
}
constexpr int m = 1000000000;
int comb[10001][10001];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N, M;
cin >> N >> M;
N = N / 1000 % M;
comb[0][0] = 1;
for(int i = 1; i <= M; ++i) comb[i][0] = comb[i][i] = 1;
for(int i = 2; i <= M; ++i){
for(int j = 1; j < i; ++j){
comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % m;
}
}
cout << comb[M][N] << endl;
return 0;
}