1 条题解
-
0
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; int pl=0,ki=0,be=0; for(int i=0;i<n;i++){ int no; cin>>no; if(no-be>0){ pl+=no-be; }else{ ki+=be-no; } be=no; } cout<<max(pl,ki); return 0; }
信息
- ID
- 260
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- 递交数
- 1
- 已通过
- 1
- 上传者