結果

問題 No.420 mod2漸化式
ユーザー kyuna
提出日時 2019-07-21 02:26:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 529 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 69,972 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 17:34:14
合計ジャッジ時間 1,945 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

long long comb(int n, int r) {
    if (r < 0 || n < r) return 0;
    long long ret = 1;
    for (int i = 1; i <= r; i++) (ret *= n--) /= i;
    return ret;
}

int main() {
    int x; cin >> x;
    if (x == 0) {
        cout << "1 0" << endl;
        return 0;
    }
    if (x > 31) {
        cout << "0 0" << endl;
        return 0;
    }
    long long cnt = comb(31, x);
    cout << cnt << " " << cnt * x / 31 * 0x7FFFFFFF << endl;
    return 0;
}
0