結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
kkslucy1
|
| 提出日時 | 2018-03-14 03:20:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 650 ms / 1,000 ms |
| コード長 | 458 bytes |
| コンパイル時間 | 1,361 ms |
| コンパイル使用メモリ | 159,072 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 18:30:47 |
| 合計ジャッジ時間 | 7,703 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll comb(int n, int k) {
if (n == k || k == 0) {
return 1;
}
else {
return comb(n - 1, k - 1) + comb(n - 1, k);
}
}
int main() {
int x;
cin >> x;
if (x > 31) {
cout << 0 << ' ' << 0 << endl;
return 0;
}
ll count = comb(31, x);
ll sum = 0;
for (int i = 0;i < 31;i++) {
sum += pow(2, i);
}
sum = count * x / 31 * sum;
cout << count << ' ' << sum << endl;
return 0;
}
kkslucy1