結果

問題 No.420 mod2漸化式
ユーザー naipia
提出日時 2018-06-25 20:03:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 501 bytes
コンパイル時間 1,311 ms
コンパイル使用メモリ 159,324 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 22:41:54
合計ジャッジ時間 2,247 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ll comb(int n,int k){
    ll ans=1;
    for(int i=1;i<k+1;i++){
        ans*=n--;
        ans/=i;
    }
    return ans;
}

int main(){
    int x;
    cin >> x;
    if(x>31) cout << 0 << ' ' << 0 << endl;
    else if(x==0) cout << 1 << ' ' << 0 << endl;
    else{
        unsigned ll num,sum;
        num=comb(31,x);
        sum=comb(30,x-1)*numeric_limits<int>::max();
        cout << num << ' ' << sum << endl;
    }
    return 0;
}
0