結果

問題 No.420 mod2漸化式
ユーザー eve__fuyuki
提出日時 2018-03-14 09:33:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 505 bytes
コンパイル時間 2,498 ms
コンパイル使用メモリ 54,652 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-26 06:04:36
合計ジャッジ時間 1,851 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int main(){
    int x;
    long long count,sum;
    cin >> x;
    if(x > 31){
        cout << 0 << " " << 0 << endl;
        return 0;
    }
    if(x == 0){
        cout << 1 << " " << 0 << endl;
        return 0;
    }
    count = 1;sum = 1;
    for(int i=0;i<x;i++){
        count = count * (31-i) / (i+1);
    }
    for(int i=0;i<x-1;i++){
        sum = sum * (30-i) / (i+1);
    }
    sum *= 2147483647;
    cout << count << " " << sum << endl;
    return 0;
}
0