結果
問題 | No.420 mod2漸化式 |
ユーザー |
|
提出日時 | 2022-09-30 13:39:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 1,000 ms |
コード長 | 820 bytes |
コンパイル時間 | 2,069 ms |
コンパイル使用メモリ | 197,968 KB |
最終ジャッジ日時 | 2025-02-07 18:35:40 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i = 0; i < (n); i++)using namespace std;typedef long long ll;template < class T >vector< vector< T > > bicoef_table(int N) {vector< vector< T > > table(N + 1, vector< T >(N + 1));table[0][0] = 1;for(int i = 1; i <= N; i++) {table[i][0] = 1;for(int j = 1; j <= N; j++) {table[i][j] = table[i - 1][j - 1] + table[i - 1][j];}}return table;}int main(){cin.tie(0);ios::sync_with_stdio(0);// popcnt(n) = xint x; cin >> x;if(x == 0) { cout << "1 0\n"; return 0; }if(x > 31) { cout << "0 0\n"; return 0; }auto comb = bicoef_table<ll>(31);ll cnt = comb[31][x];ll sum = comb[30][x - 1] * ((1LL << 31) - 1);cout << cnt << " " << sum << "\n"; return 0;}