結果

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

ソースコード

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 << " " << 0 << endl;
        return 0;
    }else if(x==0){
        cout << 1 << " " << 0 << endl;
        return 0;
    }
    cout << nCr(31,x) << " " << 2147483647*(nCr(30,x-1)) << endl;
    return 0;
}
0