結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-19 01:07:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 810 bytes |
| コンパイル時間 | 1,957 ms |
| コンパイル使用メモリ | 193,532 KB |
| 最終ジャッジ日時 | 2025-01-24 15:49:58 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long int C[32][32];
long long int dp[32];
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
C[0][0] = 1;
C[1][0] = 1;
C[1][1] = 1;
for(int i=2;i<=31;i++)
{
C[i][0] = 1;
C[i][i] = 1;
for(int j=1;j<i;j++)
{
C[i][j] = C[i-1][j-1] + C[i-1][j];
}
}
int x;
cin >> x;
if(x > 31)
{
cout << 0 << ' ' << 0 << '\n';
return 0;
}
for(int i=30;i>=0;i--)
{
for(int j=x-1;j>=0;j--)
{
long long int val = (1LL << i);
long long int way = C[30 - i][j];
val *= way;
dp[j+1] += (dp[j] + val);
}
}
cout << C[31][x] << ' ' << dp[x] << '\n';
return 0;
}