結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2023-10-21 04:39:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 847 bytes |
コンパイル時間 | 845 ms |
コンパイル使用メモリ | 119,160 KB |
最終ジャッジ日時 | 2025-02-17 12:17:54 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<cassert> #include<cmath> #include<ctime> #include<iomanip> #include<numeric> #include<stack> #include<queue> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<bitset> #include<random> using namespace std; int x; void solve() { cin >> x; if(x > 31) cout << 0 << " " << 0 << endl; else if(x == 0) cout << 1 << " " << 0 << endl; else { auto f = [&](int N,int K) -> long long { long long num = 1,den = 1; for(int i = 1;i <= K;i++) { num *= N-i+1; den *= i; if(num%den == 0) num /= den,den = 1; } return num; }; cout << f(31,x) << " " << ((1LL << 31)-1) * f(30,x-1) << endl; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--) solve(); }