結果

問題 No.266 最終進化を目指せ
コンテスト
ユーザー ciel
提出日時 2015-10-29 06:23:38
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 250 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 147 ms
コンパイル使用メモリ 29,892 KB
最終ジャッジ日時 2026-02-23 19:34:36
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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,99,sizeof(m));m[0]=0;
      |         ^~~~~~
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’

ソースコード

diff #
raw source code

N,j,x,s,m[999];
main(){
	memset(m,99,sizeof(m));m[0]=0;
	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