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:42:16
#include <stdio.h>
int main () {
int profit = 0, a, b, n;
scanf("%d%d", &n, &a);
for (int i = 0; i < n; i++) {
scanf("%d", &b);
if (b > a) profit += b - a;
a = b;
}
printf("%d", profit);
}