#395
Comori
Ali Baba și cei 40 de hoți stăpânesc un deșert de formă dreptunghiulară, împărțit în n
linii și m
coloane, care definesc n*m
sectoare. În fiecare sector se află o comoară ascunsă de Ali Baba. Se cunoaște valoarea în galbeni a fiecărei comori.
Un călător trebuie să traverseze deșertul de la Nord la Sud, trecând dintr-un sector în altul, astfel: din sectorul (i j)
se poate ajunge în unul din sectoarele (i+1,j-1)
, (i+1,j)
sau (i+1,j+1)
, dar fără a părăsi deșertul (ar fi omorât de oamenii lui Ali Baba). La trecerea printr-un sector, călătorul colectează comoara din acel sector.
Determinați valoarea totală maximă a comorilor pe care le poate colecta călătorul la traversarea deșertului, știind că pleacă din orice sector al liniei 1
și se oprește în orice sector al linei n
, cu respectarea condițiilor de mai sus.
Problema | Comori | Operații I/O |
comori.in /comori.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #25458462 | Utilizator | |
Fișier | comori.cpp | Dimensiune | 776 B |
Data încărcării | 06 Noiembrie 2020, 11:53 | Scor / rezultat | Eroare de compilare |
comori.cpp:11:1: error: stray '\302' in program cin >> n >> m; ^ comori.cpp:11:1: error: stray '\240' in program comori.cpp:11:1: error: stray '\302' in program comori.cpp:11:1: error: stray '\240' in program comori.cpp:11:1: error: stray '\302' in program comori.cpp:11:1: error: stray '\240' in program comori.cpp:12:1: error: stray '\302' in program for(int i = 1 ; i <= n ; ++i) ^ comori.cpp:12:1: error: stray '\240' in program comori.cpp:12:1: error: stray '\302' in program comori.cpp:12:1: error: stray '\240' in program comori.cpp:12:1: error: stray '\302' in program comori.cpp:12:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program for(int j = 1 ; j <= m ; j++) ^ comori.cpp:13:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program comori.cpp:13:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program comori.cpp:13:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program comori.cpp:13:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program comori.cpp:13:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program comori.cpp:13:1: error: stray '\240' in program comori.cpp:13:1: error: stray '\302' in program comori.cpp:13:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program cin >> a[i][j]; ^ comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:14:1: error: stray '\302' in program comori.cpp:14:1: error: stray '\240' in program comori.cpp:16:1: error: stray '\302' in program for(int i = 1 ; i <= n ; ++i) ^ comori.cpp:16:1: error: stray '\240' in program comori.cpp:16:1: error: stray '\302' in program comori.cpp:16:1: error: stray '\240' in program comori.cpp:16:1: error: stray '\302' in program comori.cpp:16:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program s[1][i] = a[1][i]; ^ comori.cpp:17:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program comori.cpp:17:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program comori.cpp:17:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program comori.cpp:17:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program comori.cpp:17:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program comori.cpp:17:1: error: stray '\240' in program comori.cpp:17:1: error: stray '\302' in program comori.cpp:17:1: error: stray '\240' in program comori.cpp:19:1: error: stray '\302' in program for(int i = 1 ; i <= n ; i++) ^ comori.cpp:19:1: error: stray '\240' in program comori.cpp:19:1: error: stray '\302' in program comori.cpp:19:1: error: stray '\240' in program comori.cpp:19:1: error: stray '\302' in program comori.cpp:19:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program for(int j = 1 ; j <= m ; ++j) ^ comori.cpp:20:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program comori.cpp:20:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program comori.cpp:20:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program comori.cpp:20:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program comori.cpp:20:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program comori.cpp:20:1: error: stray '\240' in program comori.cpp:20:1: error: stray '\302' in program comori.cpp:20:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program { ^ comori.cpp:21:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program comori.cpp:21:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program comori.cpp:21:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program comori.cpp:21:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program comori.cpp:21:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program comori.cpp:21:1: error: stray '\240' in program comori.cpp:21:1: error: stray '\302' in program comori.cpp:21:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program s[i][j] = a[i][j] + max(max(s[i - 1][j-1], s[i - 1][j]) , s[i - 1][j + 1]); ^ comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:22:1: error: stray '\302' in program comori.cpp:22:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program } ^ comori.cpp:23:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program comori.cpp:23:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program comori.cpp:23:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program comori.cpp:23:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program comori.cpp:23:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program comori.cpp:23:1: error: stray '\240' in program comori.cpp:23:1: error: stray '\302' in program comori.cpp:23:1: error: stray '\240' in program comori.cpp:25:1: error: stray '\302' in program int pmin = 1; ^ comori.cpp:25:1: error: stray '\240' in program comori.cpp:25:1: error: stray '\302' in program comori.cpp:25:1: error: stray '\240' in program comori.cpp:25:1: error: stray '\302' in program comori.cpp:25:1: error: stray '\240' in program comori.cpp:25:1: error: stray '\302' in program comori.cpp:25:1: error: stray '\240' in program comori.cpp:26:1: error: stray '\302' in program for(int j = 2 ; j <= m ; ++j) ^ comori.cpp:26:1: error: stray '\240' in program comori.cpp:26:1: error: stray '\302' in program comori.cpp:26:1: error: stray '\240' in program comori.cpp:26:1: error: stray '\302' in program comori.cpp:26:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program if(s[n][j] > s[n][pmin]) pmin = j; ^ comori.cpp:27:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program comori.cpp:27:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program comori.cpp:27:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program comori.cpp:27:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program comori.cpp:27:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program comori.cpp:27:1: error: stray '\240' in program comori.cpp:27:1: error: stray '\302' in program comori.cpp:27:1: error: stray '\240' in program comori.cpp:29:1: error: stray '\302' in program cout << s[n][pmin]; ^ comori.cpp:29:1: error: stray '\240' in program comori.cpp:29:1: error: stray '\302' in program comori.cpp:29:1: error: stray '\240' in program comori.cpp:29:1: error: stray '\302' in program comori.cpp:29:1: error: stray '\240' in program comori.cpp:30:1: error: stray '\302' in program return 0; ^ comori.cpp:30:1: error: stray '\240' in program comori.cpp:30:1: error: stray '\302' in program comori.cpp:30:1: error: stray '\240' in program comori.cpp:30:1: error: stray '\302' in program comori.cpp:30:1: error: stray '\240' in program
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Comori face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.