Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
33901 | qwertyuiop | 股票买卖问题 | C++ | 编译错误 | 0 MS | 0 KB | 285 | 2023-12-31 14:42:29 |
#include<bits/stdc++.h> using namespace std; int n,a[99999999],m,ans,s[99999999]; int main(){ cin>>n; for(int i=1;i<=n;i++)cin>>s[i]; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ a[i]=max(a,s[j]-s[i]); } if(i%2==0)ans+=a[i]; } cout<<ans; return 0; }