Cod sursa(job #1709003)
Utilizator | Data | 28 mai 2016 10:31:30 | |
---|---|---|---|
Problema | Twoton | Scor | 0 |
Compilator | cpp | Status | done |
Runda | ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest | Marime | 0.39 kb |
#include <iostream>
#include <cstdio>
using namespace std;
int T;
int main() {
freopen("twoton.in", "r", stdin);
freopen("twoton.out", "w", stdout);
scanf("%d", &T);
long long sol = 0;
int m = 100001;
while(T--) {
int x;
scanf("%d", &x);
if(x < m) m = x;
sol+=m;
}
printf("%lld\n", sol);
return 0;
}