Cod sursa(job #3250355)
| Utilizator | Data | 20 octombrie 2024 13:23:47 | |
|---|---|---|---|
| Problema | Euro | Scor | 25 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("euro.in");
ofstream fout ("euro.out");
long long n, t;
long long lei, euro, val;
int main()
{
fin >> n >> t;
for(int i = 1 ; i <= n ; i++)
{
fin >> val;
euro += val;
if(euro < 0)
{
lei += (euro * i - t);
euro = 0;
}
}
if(euro != 0)
{
lei += (euro * n - t);
}
fout << lei;
return 0;
}
