数组都不需要
#include<bits/stdc++.h> using namespace std; int n,maxn,ans; int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>n; while(n--){ int x; cin>>x; if(x>maxn){ maxn=x;ans++; } } cout<<ans; return 0; }
注册一个 CZOJ 通用账户,您就可以在我们提供的所有在线评测服务上提交代码、参与讨论。
使用您的 CZOJ 通用账户