結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2016-09-10 01:12:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,019 bytes |
コンパイル時間 | 772 ms |
コンパイル使用メモリ | 83,032 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:26:02 |
合計ジャッジ時間 | 1,944 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include <iostream> #include <string> #include <map> #include <vector> #include <set> #include <fstream> #include <stdint.h> #include <cmath> #include <algorithm> #include <utility> #include <numeric> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define RREP(i,n) for(int i = (n)-1; i >= 0; i--) #define FOR(i, l, r) for(int i = l; i < r; i++) #define RFOR(i, l,r) for(int i= (l)-1; i>= (r) ; i--) constexpr long long TT = (1L << 31) - 1; int main() { ios::sync_with_stdio(false); int x; cin >> x; if(x > 31) { cout << "0 0\n"; } else { long com[32][32]={}; REP(i,32) { com[i][0] = 1; for(int j = 1; j <= i; j++) { com[i][j] = com[i-1][j] + com[i-1][j-1]; } } long ans = com[31][x]; long long sum; if(x == 0) sum = 0; else sum = TT * com[30][x-1]; cout << ans << ' ' << sum << '\n'; } }