結果
| 問題 | 
                            No.287 場合の数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bekasa001
                         | 
                    
| 提出日時 | 2015-10-09 22:56:50 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                CE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 476 bytes | 
| コンパイル時間 | 124 ms | 
| コンパイル使用メモリ | 27,332 KB | 
| 最終ジャッジ日時 | 2024-11-14 19:18:40 | 
| 合計ジャッジ時間 | 709 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:6: error: ‘scanf’ was not declared in this scope
    8 |   if(scanf("%d", &N) == EOF) {
      |      ^~~~~
main.cpp:8:25: error: ‘EOF’ was not declared in this scope
    8 |   if(scanf("%d", &N) == EOF) {
      |                         ^~~
main.cpp:3:1: note: ‘EOF’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
    2 | #include <algorithm>
  +++ |+#include <cstdio>
    3 | using namespace std;
main.cpp:23:3: error: ‘printf’ was not declared in this scope
   23 |   printf("%lld\n", dp[8][2 * N]);
      |   ^~~~~~
main.cpp:23:3: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
            
            ソースコード
#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;
}
            
            
            
        
            
bekasa001