結果

問題 No.45 回転寿司
ユーザー zuvizudar
提出日時 2016-12-23 05:13:58
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 289 bytes
コンパイル時間 997 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 15:41:33
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",&N);
      |         ^~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d",&v[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int max(int a,int b);

int main(){
	int i,j,k,N,v[1001];
	int t=0,p=0,q=0;

	scanf("%d",&N);
	for(i=0;i<N+1;i++){
		scanf("%d",&v[i]);
		t=q+v[i];		
		j=max(p,q);	
		q=j;
		p=t;
	}
	printf("%d\n",q);
	return 0;
}
int max(int a,int b){
	if(a>b)return a;
	else return b;
}
0