Borderou de evaluare (job #2286396)

Utilizator Opariuc_RaresOpariuc Rares Ioan Opariuc_Rares Data 20 noiembrie 2018 10:29:22
Problema Problema rucsacului Status done
Runda Arhiva educationala Compilator cpp-64 | Vezi sursa
Scor 0

Raport evaluator

Eroare de compilare: main.cpp:1:20: warning: extra tokens at end of #include directive #include <fstream> #define NMAX 5004 ^ main.cpp:3:90: error: 'NMAX' was not declared in this scope using namespace std; ifstream fin("rucsac.in"); ofstream fout("rucsac.out"); int n, G, g[NMAX], c[NMAX], cmax[GMAX]; void citire(); void pd();int main(){ citire(); pd(); fout << cmax[G] << '\n'; return 0;}void citire(){int i;fin >> n >> G;for (i = 1; i <= n; i++) fin >> g[i] >> c[i];}void pd(){int i, x; cmax[0] = 0;for (i = 1; i <= n; i++) for (x = G; x > 0; x--) if (x >= g[i]) if (cmax[x] < c[i] + cmax[x - g[i]]) cmax[x] = c[i] + cmax[x - g[i]];} ^~~~ main.cpp:3:99: error: 'NMAX' was not declared in this scope using namespace std; ifstream fin("rucsac.in"); ofstream fout("rucsac.out"); int n, G, g[NMAX], c[NMAX], cmax[GMAX]; void citire(); void pd();int main(){ citire(); pd(); fout << cmax[G] << '\n'; return 0;}void citire(){int i;fin >> n >> G;for (i = 1; i <= n; i++) fin >> g[i] >> c[i];}void pd(){int i, x; cmax[0] = 0;for (i = 1; i <= n; i++) for (x = G; x > 0; x--) if (x >= g[i]) if (cmax[x] < c[i] + cmax[x - g[i]]) cmax[x] = c[i] + cmax[x - g[i]];} ^~~~ main.cpp: In function 'void citire()': main.cpp:3:272: error: 'g' was not declared in this scope using namespace std; ifstream fin("rucsac.in"); ofstream fout("rucsac.out"); int n, G, g[NMAX], c[NMAX], cmax[GMAX]; void citire(); void pd();int main(){ citire(); pd(); fout << cmax[G] << '\n'; return 0;}void citire(){int i;fin >> n >> G;for (i = 1; i <= n; i++) fin >> g[i] >> c[i];}void pd(){int i, x; cmax[0] = 0;for (i = 1; i <= n; i++) for (x = G; x > 0; x--) if (x >= g[i]) if (cmax[x] < c[i] + cmax[x - g[i]]) cmax[x] = c[i] + cmax[x - g[i]];} ^ main.cpp:3:280: error: 'c' was not declared in this scope using namespace std; ifstream fin("rucsac.in"); ofstream fout("rucsac.out"); int n, G, g[NMAX], c[NMAX], cmax[GMAX]; void citire(); void pd();int main(){ citire(); pd(); fout << cmax[G] << '\n'; return 0;}void citire(){int i;fin >> n >> G;for (i = 1; i <= n; i++) fin >> g[i] >> c[i];}void pd(){int i, x; cmax[0] = 0;for (i = 1; i <= n; i++) for (x = G; x > 0; x--) if (x >= g[i]) if (cmax[x] < c[i] + cmax[x - g[i]]) cmax[x] = c[i] + cmax[x - g[i]];} ^ main.cpp: In function 'void pd()': main.cpp:3:376: error: 'g' was not declared in this scope using namespace std; ifstream fin("rucsac.in"); ofstream fout("rucsac.out"); int n, G, g[NMAX], c[NMAX], cmax[GMAX]; void citire(); void pd();int main(){ citire(); pd(); fout << cmax[G] << '\n'; return 0;}void citire(){int i;fin >> n >> G;for (i = 1; i <= n; i++) fin >> g[i] >> c[i];}void pd(){int i, x; cmax[0] = 0;for (i = 1; i <= n; i++) for (x = G; x > 0; x--) if (x >= g[i]) if (cmax[x] < c[i] + cmax[x - g[i]]) cmax[x] = c[i] + cmax[x - g[i]];} ^ main.cpp:3:396: error: 'c' was not declared in this scope using namespace std; ifstream fin("rucsac.in"); ofstream fout("rucsac.out"); int n, G, g[NMAX], c[NMAX], cmax[GMAX]; void citire(); void pd();int main(){ citire(); pd(); fout << cmax[G] << '\n'; return 0;}void citire(){int i;fin >> n >> G;for (i = 1; i <= n; i++) fin >> g[i] >> c[i];}void pd(){int i, x; cmax[0] = 0;for (i = 1; i <= n; i++) for (x = G; x > 0; x--) if (x >= g[i]) if (cmax[x] < c[i] + cmax[x - g[i]]) cmax[x] = c[i] + cmax[x - g[i]];} ^ Non zero exit status: 1

Ceva nu functioneaza?