Submission #159796

#TimeUsernameProblemLanguageResultExecution timeMemory
159796DodaTarifa (COCI16_tarifa)C++98
0 / 50
3 ms504 KiB
#include <iostream> using namespace std; int main () { int x,n,p,a,y; cin >> y >> n ; x = y; for (int i = 0; i<n ; i++){ cin >> p; x = y; x+= a; a = 0; if (p<x){ a += x-p ; } } int q = a+y; cout << q; return 0; }

Compilation message (stderr)

tarifa.cpp: In function 'int main()':
tarifa.cpp:18:5: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
 int q = a+y;
     ^
#Verdict Execution timeMemoryGrader output
Fetching results...