AcWing每日一题--最大波动

https://www.acwing.com/problem/content/3235/

水题。

 1 #include<iostream>
 2 #include<cmath>
 3 using namespace std;
 4 int main(void){
 5     int n;
 6     cin>>n;
 7     int res=0,pre=0x3f3f3f3f;
 8     for(int i=0;i<n;i++){
 9         int t;
10         cin>>t;
11         if(pre!=0x3f3f3f3f)
12             res=max(res,abs(t-pre));
13         pre=t;
14     }
15     cout<<res;
16     return 0;
17 }
原文地址:https://www.cnblogs.com/greenofyu/p/14555866.html