제출 #160314

#제출 시각아이디문제언어결과실행 시간메모리
160314model_codeMean (info1cup19_mean)C++17
100 / 100
4 ms504 KiB
#include <bits/stdc++.h> using namespace std; int n,i,j,k,h,x,Max,a[204],d[204][204]; int main() { scanf ("%d", &n); assert ((1<=n) && (n<=200)); for (i=1;i<=n;i++) { scanf ("%d", &a[i]); assert ((1<=a[i]) && (a[i]<=1000000000)); } for (i=1;i<=n;i++) d[i][i]=a[i]; for (i=1;i<=(n-1);i++) for (j=1;j<=(n-i);j++) { k=i+j; Max=-2000000000; for (h=j;h<=(k-1);h++) { x=d[j][h]+d[h+1][k]; x/=2; if (x>Max) Max=x; } d[j][k]=Max; } printf ("%d\n", Max); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

mean.cpp: In function 'int main()':
mean.cpp:7:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d", &n);
     ~~~~~~^~~~~~~~~~
mean.cpp:11:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%d", &a[i]);
         ~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...