5 条题解
题解与来源题共享。已有题解默认通过;新增或编辑后需由来源域管理员审核。待审核、驳回题解仅作者和审核管理员可见。来源域:system
-
1
最精简的一集
#include<bits/stdc++.h> using namespace std; using ll=long long; #define endl '\n' ll n,m,k; void solve() { cin>>n; vector<ll>arr(n+1,1); ll ans=0; for(int i=1;i<=n;i++) { cin>>arr[i]; if(arr[i]>arr[i-1])ans+=arr[i]-arr[i-1]; } cout<<ans<<endl; } int main() { ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr); ll T=1; //cin>>T; while(T--) { solve(); } return 0; }
信息
- ID
- 335
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 普及−
- 标签
- 递交数
- 701
- 已通过
- 264
- 上传者