結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2019-04-07 18:59:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 452 ms |
コンパイル使用メモリ | 56,584 KB |
実行使用メモリ | 10,148 KB |
最終ジャッジ日時 | 2024-06-27 14:34:34 |
合計ジャッジ時間 | 13,124 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &v[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <algorithm> using namespace std; int ssh(int *d, int n) { if(n < 0) return 0; return max(ssh(d, n-2) + d[n], ssh(d, n-1)); } int main() { int n, v[1000] = {0}; cin >> n; for(int i = 0; i < n; i++){ scanf("%d", &v[i]); } cout << ssh(v, n-1) << endl; return 0; }