結果
問題 | No.45 回転寿司 |
ユーザー |
![]() |
提出日時 | 2016-11-07 03:30:20 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 650 bytes |
コンパイル時間 | 2,003 ms |
コンパイル使用メモリ | 77,372 KB |
実行使用メモリ | 122,996 KB |
最終ジャッジ日時 | 2024-11-25 03:35:45 |
合計ジャッジ時間 | 178,477 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 2 TLE * 20 OLE * 8 |
ソースコード
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));}}