結果

問題 No.266 最終進化を目指せ
コンテスト
ユーザー ciel
提出日時 2015-10-29 06:24:17
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 245 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 160 ms
コンパイル使用メモリ 30,148 KB
最終ジャッジ日時 2026-02-23 19:34:38
ジャッジサーバーID
(参考情報)
judge2 / 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[999];
      | ^
main.c: In function ‘main’:
main.c:3:9: warning: incompatible implicit declaration of built-in function ‘memset’ [-Wbuiltin-declaration-mismatch]
    3 |         memset(m+1,99,sizeof(m));
      |         ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memset’
  +++ |+#include <string.h>
    1 | N,j,x,s,m[999];
main.c:4:13: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    4 |         for(scanf("%d",&N);~N;N--)for(scanf("%d",&s),j=0;j<=s;j++){
      |             ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | N,j,x,s,m[999];
main.c:8:24: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
    8 |         for(j=s;~s;s--)printf(s?"%d ":"%d\n",m[j-s]);
      |                        ^~~~~~
main.c:8:24: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:3:9: warning: ‘memset’ writing 3996 bytes into a region of size 3992 overflows the destination [-Wstringop-overflow=]
    3 |         memset(m+1,99,sizeof(m));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:1:9: note: at offset 4 into destination object ‘m’ of size 3996
    1 | N,j,x,s,m[999];
      |         ^

ソースコード

diff #
raw source code

N,j,x,s,m[999];
main(){
	memset(m+1,99,sizeof(m));
	for(scanf("%d",&N);~N;N--)for(scanf("%d",&s),j=0;j<=s;j++){
		m[j]++;
		for(x=0;x<(j+1)/2;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