結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2017-01-11 23:06:31 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 330 bytes |
コンパイル時間 | 865 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 09:53:19 |
合計ジャッジ時間 | 1,225 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:16: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | int n; scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:6:47: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | int v[n]; for (int i = 0; i < n; i++) scanf("%d", &v[i]); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #define max(a, b) (a > b)?a:b int main(){ // データ読み込み int n; scanf("%d", &n); int v[n]; for (int i = 0; i < n; i++) scanf("%d", &v[i]); // main int p = 0; int q = 0; int tmp_p; for (int i = 0; i < n; ++i) { tmp_p = p; p = v[i] + q; q = max(tmp_p, q); } printf("%d\n", max(p, q)); }