結果

問題 No.420 mod2漸化式
コンテスト
ユーザー okayunonaha
提出日時 2016-09-18 03:34:36
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 438 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 379 ms
コンパイル使用メモリ 71,648 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-12 07:31:37
合計ジャッジ時間 1,836 ms
ジャッジサーバーID
(参考情報)
tmp-judge_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31 WA * 1 RE * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:21:27:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'nsum' may be used uninitialized [-Wmaybe-uninitialized]
  212 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:17:17: note: 'nsum' was declared here
   17 |   int x, Count, nsum;
      |                 ^~~~

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;
typedef long long ll;
#define int ll

// start
int comb[32][32];

int C(int n, int k) {
  if(comb[n][k]) return comb[n][k];
  else if(n == k || !k) return comb[n][k] = 1;
  return comb[n][k] = C(n-1, k) + C(n-1, k-1);
}
//end

signed main(void) {
  int x, Count, nsum;
  cin >> x;
  Count = C(31, x);
  if(x!=0) nsum = C(30, x-1) * 2147483647;
  cout << Count << " " << nsum << endl;
  return 0;
}
0