Submission #998002
Source Code Expand
#include<stdio.h> long long MAX(long long a,long long b){return a<b?b:a;} long long d[310][100010]={}; int main(){ long long n,m,k,a[100010],i,j; scanf("%lld %lld %lld",&n,&m,&k); for(i=0;i<n;i++)scanf("%lld",&a[i]); for(i=0;i<k;i++){ for(j=0;j<n;j++){ d[i+1][j+1]=MAX(d[i+1][j+1],d[i+1][j]); d[i+1][j+1]=MAX(d[i+1][j+1],d[i][j]+(i+1)*a[j]);//,d[i+1][j]+(i+1)*(a[j+1]-a[j])); } } //for(i=0;i<=k;i++){ for(j=0;j<=n;j++)printf("%2lld ",d[i][j]);printf("\n"); }//*/ printf("%lld\n",d[k][n]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Struck Out |
User | yuiop |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 560 Byte |
Status | CE |
Compile Error
./Main.c:17:10: error: expected declaration specifiers or ‘...’ before string constant printf("%lld\n",d[k][n]); ^ ./Main.c:17:19: error: expected declaration specifiers or ‘...’ before ‘d’ printf("%lld\n",d[k][n]); ^ ./Main.c:18:3: error: expected identifier or ‘(’ before ‘return’ return 0; ^ ./Main.c:19:1: error: expected identifier or ‘(’ before ‘}’ token } ^ ./Main.c: In function ‘main’: ./Main.c:6:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld %lld %lld",&n,&m,&k); ^ ./Main.c:7:19: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] for(i=0;i<n;i++)scanf("%lld",&a[i]); ^