Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
133854 张泽辰 买卖股票的最佳时机 C++ 解答错误 33 0 MS 252 KB 298 2024-03-02 09:59:14

Tests(1/3):


#include<bits/stdc++.h> using namespace std; int main() { int n,nums[1001],max_=0; cin>>n; for(int i=1;i<=n;i++) { cin>>nums[i]; int s=0; if(nums[i]>0) { s+=nums[i]; } else { continue; } if(s>max_) { max_=s; } } cout<<max_; return 0; }


测评信息: