求最大值 题解
2023-09-23 17:42:27
发布于:广东
13阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,maxn=-10000;//maxn初始为-10000(小于-1000都可以)好让最开始的数大于maxn
cin>>n;
for(int i=1;i<=n;i++){
int t;
cin>>t;
if(t>maxn)maxn=t;
}
cout<<maxn;
return 0;
}
AC
这里空空如也
有帮助,赞一个