結果

問題 No.266 最終進化を目指せ
コンテスト
ユーザー ciel
提出日時 2015-10-29 06:25:35
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 226 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 129 ms
コンパイル使用メモリ 29,892 KB
最終ジャッジ日時 2026-02-23 19:34:39
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | N,j,x,s,m[99];
      | ^
main.c: In function ‘main’:
main.c:3:13: warning: incompatible implicit declaration of built-in function ‘memset’ [-Wbuiltin-declaration-mismatch]
    3 |         for(memset(m+1,99,sizeof(m)),scanf("%d",&N);~N;N--)for(scanf("%d",&s),j=0;j<=s;j++)for(m[j]++,x=0;x<j;x++)m[j]=m[j]<(m[x]+m[j-1-x])?m[j]:(m[x]+m[j-1-x]);
      |             ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memset’
  +++ |+#include <string.h>
    1 | N,j,x,s,m[99];
main.c:3:38: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    3 |         for(memset(m+1,99,sizeof(m)),scanf("%d",&N);~N;N--)for(scanf("%d",&s),j=0;j<=s;j++)for(m[j]++,x=0;x<j;x++)m[j]=m[j]<(m[x]+m[j-1-x])?m[j]:(m[x]+m[j-1-x]);
      |                                      ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | N,j,x,s,m[99];
main.c:4:24: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
    4 |         for(j=s;~s;s--)printf(s?"%d ":"%d\n",m[j-s]);
      |                        ^~~~~~
main.c:4:24: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:3:13: warning: ‘memset’ writing 396 bytes into a region of size 392 overflows the destination [-Wstringop-overflow=]
    3 |         for(memset(m+1,99,sizeof(m)),scanf("%d",&N);~N;N--)for(scanf("%d",&s),j=0;j<=s;j++)for(m[j]++,x=0;x<j;x++)m[j]=m[j]<(m[x]+m[j-1-x])?m[j]:(m[x]+m[j-1-x]);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:1:9: note: at offset 4 into destination object ‘m’ of size 396
    1 | N,j,x,s,m[99];
      |         ^

ソースコード

diff #
raw source code

N,j,x,s,m[99];
main(){
	for(memset(m+1,99,sizeof(m)),scanf("%d",&N);~N;N--)for(scanf("%d",&s),j=0;j<=s;j++)for(m[j]++,x=0;x<j;x++)m[j]=m[j]<(m[x]+m[j-1-x])?m[j]:(m[x]+m[j-1-x]);
	for(j=s;~s;s--)printf(s?"%d ":"%d\n",m[j-s]);
}
0