Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: Sense.exe

Problemset: จับคู่เลขมงคล

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-07 19:01:16

#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;
}