Submission

Status:

[PP-SSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: purihorharin

Problemset: stock

Language: c

Time: 0.002 second

Submitted On: 2026-03-20 19:46:02

#include <stdio.h>

int main () {
    long long profit = 0, a, b, n;
    scanf("%lld%lld", &n, &a);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &b);
        if (b > a) profit += b - a;
        a = b;
    }
    printf("%lld", profit);
}