【BZOJ】【P1307&P1318】【题解】【max_element】

来源:互联网 发布:微信公众号淘宝客制作 编辑:程序博客网 时间:2024/06/03 15:09

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1307 http://www.lydsy.com/JudgeOnline/problem.php?id=1318

抱着试一试的心态……

A了……

Code:

#include<bits/stdc++.h>using namespace std;const int maxn=1e6+5;int n;int getint(){int res=0;char c=getchar();while(!isdigit(c))c=getchar();while(isdigit(c))res=res*10+c-'0',c=getchar();return res;}int a[maxn];int main(){n=getint();for(int i=1;i<=n;i++)a[i]=getint();cout<<*max_element(a+1,a+1+n)<<endl;return 0;}


0 0
原创粉丝点击