Submission
Status:
[PPPP-SSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: Neozaawwman1
Problemset: ซื้อขายหุ้นซีเค
Language: cpp
Time: 0.008 second
Submitted On: 2026-03-10 22:46:02
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int ans = 0;
int N;
vector<int> v;
int main(){
ios_base::sync_with_stdio(0),cin.tie(0);
cin >> N;
while(N--){
int x;
cin >> x;
v.push_back(x);
}
for(int i = 1; i < v.size(); i++){
if(v[i] > v[i-1])
ans += (v[i] - v[i-1]);
}
cout << ans;
return 0;
}