結果

問題 No.45 回転寿司
ユーザー takatowin
提出日時 2017-01-09 01:11:58
言語 C90
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 385 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 14,784 KB
最終ジャッジ日時 2024-12-17 23:25:05
合計ジャッジ時間 176,056 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 2 TLE * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 | scanf("%d",&N);
      | ^~~~~~~~~~~~~~
main.c:20:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |   scanf("%d",&v[i]);
      |   ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int N;
int max(int a,int b){
  return a>b ? a : b;
}
int saiki(int* v,int n,int temp){
  if(n<N){
    return max(saiki(v,n+1,temp),saiki(v,n+2,temp+v[n]));
  }else
    return temp;
}
int main(void){
int i;
scanf("%d",&N);
int v[N];
for(i=0;i<N;i++)
  scanf("%d",&v[i]);
printf("%d\n",saiki(v,0,0));
  return 0;
}
0