結果

問題 No.420 mod2漸化式
ユーザー Nagisa
提出日時 2016-09-19 09:26:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 635 bytes
コンパイル時間 1,588 ms
コンパイル使用メモリ 166,540 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 09:16:50
合計ジャッジ時間 2,462 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
typedef unsigned long long ll;

ll nCr(int n, int r){
    if(n<r*2){
        r = n-r;
    }
    ll u = 1, d = 1;
    int q = r;
    while(q>0){
        u*=n;
        n--;
        q--;
    }
    while(r>0){
        d*=r;
        r--;
    }
    return u/d;
}

int main() {
    int x;
    cin >> x;
    if(x>=32){
        cout << 0 << endl << 0 << endl;
        return 0;
    }else if(x==0){
        cout << 1 << endl << 0 << endl;
        return 0;
    }
    cout << nCr(31,x) << " " << (pow(2,31)-1)*(nCr(30,x-1)) << endl;
    return 0;
}
0