結果

問題 No.287 場合の数
コンテスト
ユーザー testestest
提出日時 2015-10-18 14:23:52
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 288 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 89 ms
コンパイル使用メモリ 21,572 KB
最終ジャッジ日時 2026-02-23 19:33:57
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | n;
      | ^
main.c:2:1: warning: data definition has no type or storage class
    2 | check[9][601];
      | ^~~~~
main.c: In function ‘f’:
main.c:10:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
   10 | for(int i=0;i<=n&&i<=s;i++)count[k][s]+=f(k-1,s-i);
      | ^~~
main.c:10:1: note: use option ‘-std=c99’, ‘-std=gnu99’, ‘-std=c11’ or ‘-std=gnu11’ to compile your code
main.c: In function ‘main’:
main.c:15:4: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   15 | n=!printf("%ld",f(8,(n=atoi(gets(&n)))*6));
      |    ^~~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | n;

ソースコード

diff #
raw source code

n;
check[9][601];
long count[9][601];

long f(int k,int s){
if(k==1||s==0)return s<=n;
if(s>n*k)return 0;
if(check[k][s])return count[k][s];
check[k][s]++;
for(int i=0;i<=n&&i<=s;i++)count[k][s]+=f(k-1,s-i);
return count[k][s];
}

int main(){
n=!printf("%ld",f(8,(n=atoi(gets(&n)))*6));
}
0