Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Sense.exe
Problemset: ประมูลการกุศล
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-07 19:00:31
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,temp,win=0,cur;
cin >> n;
bool first = true;
for(int i=0; i<n; i++) {
cin >> temp;
if(first) {
win+=temp;
first = false;
cur = temp;
// cout << temp << " ";
continue;
}
if(temp>cur) {
win+=temp;
cur = temp;
// cout << temp << " ";
}
}
cout << win;
}