結果

問題 No.420 mod2漸化式
ユーザー DaYuanChi
提出日時 2021-01-26 23:57:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 539 bytes
コンパイル時間 1,504 ms
コンパイル使用メモリ 167,464 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 21:55:41
合計ジャッジ時間 2,578 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll C(int m, int n){
  ll now = 1;
  for(int i = 0; i < n; i++){
    now = (now*(m-i))/(i+1);
  }
  return now;
}

int main(){
  int x; cin >> x;
  if(x>31){
    cout << 0 << " " << 0 << endl;
    return 0;
  }else{
    ll ans1 = 0;
    if(x>0)ans1 = C(31, x);
    else ans1 = 1;
    ll ans2 = 0;
    for(int i = 0; i <= 30; i++) ans2 += pow(2,i);
    if(x>0)ans2 *= C(30, x-1);
    else ans2 = 0;
    cout << ans1 << " " << ans2 << endl;
    return 0;
  }
}
    
    
  
0