結果
問題 | No.420 mod2漸化式 |
ユーザー |
|
提出日時 | 2018-05-21 16:16:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 537 bytes |
コンパイル時間 | 521 ms |
コンパイル使用メモリ | 64,000 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 15:00:19 |
合計ジャッジ時間 | 1,880 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include<iostream>using namespace std;typedef long long ll;ll getcomb(ll a, ll b){ll ans = 1;for(int i = 1; i <= b; i++){ans *= (a-i+1);ans /= i;}return ans;}int main(){ll max = (1ll<<31)-1;ll n;cin >> n;if(n > 31){cout << 0 << " " << 0 << endl;}else if(n == 0){cout << 1 << " " << 0 << endl;}else{ll comb = getcomb(31,n);ll sum = max * getcomb(30,n-1);cout << comb << " " << sum << endl;}return 0;}