結果
問題 | No.1785 Inequality Signs |
ユーザー | 👑 Nachia |
提出日時 | 2021-12-14 00:09:21 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 2,368 ms |
コンパイル使用メモリ | 111,660 KB |
最終ジャッジ日時 | 2025-01-26 09:50:36 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 52 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <atcoder/modint> using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) using m32 = atcoder::modint1000000007; int main() { i64 N,K; cin >> N >> K; K--; m32 rComb = 1; for(int i=1; i<=N; i++) rComb /= i; for(int i=0; i<N; i++) rComb *= N+K-i; m32 lComb = 1; m32 ans = lComb * rComb; for(int n=1; n<=min(N-1,K); n++){ lComb *= (N-n); lComb /= n; rComb *= K-n+1; rComb /= N+K-n+1; ans += lComb * rComb; } cout << ans.val() << endl; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;