結果
問題 |
No.45 回転寿司
|
ユーザー |
|
提出日時 | 2023-08-16 17:14:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 1,884 ms |
コンパイル使用メモリ | 190,300 KB |
最終ジャッジ日時 | 2025-02-16 08:47:11 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int N=1e3+9; int n,a[N],dp[N]; int main(){ #ifdef memset0 freopen("1.in","r",stdin); #endif ios::sync_with_stdio(0),cin.tie(0); cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; dp[i]=max(dp[i-1],dp[i-2]+a[i]); } cout<<dp[n]<<endl; }