結果
| 問題 | No.45 回転寿司 |
| ユーザー |
vektor_dnchr
|
| 提出日時 | 2016-11-07 03:30:20 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 650 bytes |
| 記録 | |
| コンパイル時間 | 2,047 ms |
| コンパイル使用メモリ | 83,420 KB |
| 実行使用メモリ | 54,676 KB |
| 最終ジャッジ日時 | 2026-05-19 11:54:25 |
| 合計ジャッジ時間 | 15,034 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | OLE * 1 -- * 29 |
ソースコード
import java.util.*;
public class Main {
static int N;
static int[] V = new int[1000];
public static int rec(int i){
int ret;
if(i >= N){ret = 0;}
else{
ret = Math.max(rec(i+1), rec(i+2)+V[i]);
System.out.println(rec(i+1)+ " " +(rec(i+2)+V[i]));
}
return ret;
}
public static void main(String[] args) throws Exception {
// Here your code !
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
for(int i=0; i<N; i++) V[i] = sc.nextInt();
System.out.println(rec(0));
}
}
vektor_dnchr