小W與炒股

思路: 這題是一道貪心題,每個股票在最低谷買最高峯買,就能獲得最大利益,這題主要的坑點在於輸入要優化,否則會TLE 代碼: #include<bits/stdc++.h> #define ll long long using namespace std; ll n,ans; priority_queue<ll,vector<ll>,greater<ll> >q; inline ll read()
相關文章
相關標籤/搜索