Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
32052 石利伟 最大和与最小和 C++ Accepted 100 0 MS 248 KB 350 2022-02-09 10:34:15

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int n,num[101],x,y,m=99999,g=-99999,sum; int main(){ cin>>n; for(int i=0;i<n;i++)cin>>num[i]; for(int i=0;i<n;i++){ sum=num[i]; if(sum>g)g=sum; if(sum<m)m=sum; for(int j=i+1;j<n;j++){ sum+=num[j]; if(sum>g)g=sum; if(sum<m)m=sum; } } cout<<g<<endl<<m; return 0; }


Judgement Protocol: