結果

問題 No.420 mod2漸化式
ユーザー aaaaaaiu
提出日時 2019-08-16 22:30:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 484 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 194,056 KB
最終ジャッジ日時 2025-01-07 12:29:27
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:34: warning: integer overflow in expression of type ‘int’ results in ‘2147483647’ [-Woverflow]
   23 |     cout<<c[31][x]<<' '<<((1<<31)-1)*c[30][x-1]<<endl;;
      |                           ~~~~~~~^~

ソースコード

diff #

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

int main() {
    ll c[32][32];
    for (int i=0;i<=31;i++) {
        c[i][0]=c[i][i]=1;
    }
    for (int i=2;i<=31;i++)
        for (int j=1;j<i;j++)
            c[i][j]=c[i-1][j-1]+c[i-1][j];
    int x;
    cin>>x;
    if (x>31) {
        cout<<"0 0\n";
        return 0;
    }
    if (x==0) {
        cout<<"1 0\n";
        return 0;
    }
    cout<<c[31][x]<<' '<<((1<<31)-1)*c[30][x-1]<<endl;;
    return 0;
}
0