結果

問題 No.287 場合の数
ユーザー bekasa001bekasa001
提出日時 2015-10-09 22:56:50
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 476 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 31,904 KB
最終ジャッジ日時 2023-08-07 18:55:14
合計ジャッジ時間 422 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:6: error: ‘scanf’ was not declared in this scope
   if(scanf("%d", &N) == EOF) {
      ^~~~~
main.cpp:8:6: note: suggested alternative: ‘srand’
   if(scanf("%d", &N) == EOF) {
      ^~~~~
      srand
main.cpp:8:25: error: ‘EOF’ was not declared in this scope
   if(scanf("%d", &N) == EOF) {
                         ^~~
main.cpp:8:25: note: ‘EOF’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
main.cpp:3:1:
+#include <cstdio>
 using namespace std;
main.cpp:8:25:
   if(scanf("%d", &N) == EOF) {
                         ^~~
main.cpp:23:3: error: ‘printf’ was not declared in this scope
   printf("%lld\n", dp[8][2 * N]);
   ^~~~~~
main.cpp:23:3: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?

ソースコード

diff #

#include <algorithm>
using namespace std;
typedef long long llint;

int main() {
  int N;
  if(scanf("%d", &N) == EOF) {
    return 0;
  }
  llint dp[9][2 * N + 1];
  for(int i = 0; i < 9; i++) {
    fill(dp[i], dp[i] + 2 * N + 1, 0);
  }
  dp[0][0] = 1;
  for(int i = 0; i < 8; i++) {
    for(int j = 0; j <= 2 * N; j++) {
      for(int k = 0; k <= N && j + k <= 2 * N; k++) {
	dp[i + 1][j + k] += dp[i][j];
      }
    }
  }
  printf("%lld\n", dp[8][2 * N]);
  return 0;
}
0