Submission
Status:
[PP-SSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: purihorharin
Problemset: stock
Language: c
Time: 0.001 second
Submitted On: 2026-03-20 19:48:45
#include <stdio.h>
int main () {
long long profit = 0, a, b, n;
scanf("%lld%lld", &n, &a);
for (int i = 1; i < n; i++) {
scanf("%lld", &b);
if (b > a) profit += b - a;
a = b;
}
printf("%lld", profit);
}