#4410
Pe un câmp asemănător cu o tablă de şah cu M linii şi N coloane, o ţurcană se află în pătrăţelul de coordonate (1,1) aflat în colţul din stânga-sus al tablei şi vrea să ajungă în pătrăţelul de coordonate (M,N) aflat în colţul din dreapta-jos al tablei. Ea poate efectua sărituri de lungime cel mult P la dreapta, de lungime cel mult Q în jos, de lungime cel mult R pe diagonală spre dreapta-jos, precum şi săritura calului, adică două pătrăţele la dreapta şi unul în jos sau două în jos şi unul la dreapta. Orice săritură trebuie să schimbe poziţia ţurcanei. Se dă un număr întreg C.
- Dacă C=1, să se determine numărul minim de sărituri necesare pentru a ajunge în pătrăţelul de coordonate (M,N).
- Dacă C=2, să se determine numărul de moduri în care poate să ajungă în pătrăţelul de coordonate (M,N), nu neapărat cu număr minim de sărituri.
OJI 2023, clasele XI-XII
| Problema | Turcane | Operații I/O |
turcane.in/turcane.out
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 256 MB
/
Stivă 64 MB
|
| Id soluție | #63282868 | Utilizator | |
| Fișier | turcane.cpp | Dimensiune | 2.15 KB |
| Data încărcării | 24 Februarie 2026, 19:14 | Scor/rezultat | Eroare de compilare |
turcane.cpp:7:21: error: expected initializer before numeric constant const long long MOD 1 000 000 007 ^ turcane.cpp: In function 'void citire()': turcane.cpp:14:6: error: 'c' was not declared in this scope fin>>c; ^ turcane.cpp:15:6: error: 'n' was not declared in this scope fin>>n>>m; ^ turcane.cpp:15:9: error: 'm' was not declared in this scope fin>>n>>m; ^ turcane.cpp:16:6: error: 'p' was not declared in this scope fin>>p>>q>>r; ^ turcane.cpp:16:9: error: 'q' was not declared in this scope fin>>p>>q>>r; ^ turcane.cpp:16:12: error: 'r' was not declared in this scope fin>>p>>q>>r; ^ turcane.cpp: In function 'void c1()': turcane.cpp:21:16: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ turcane.cpp:22:24: error: 'm' was not declared in this scope for(int j=1;j<=m;j++) ^ turcane.cpp:23:23: error: 'INT_MAX' was not declared in this scope dp[i][j]=(INT_MAX>>1); ^ turcane.cpp:27:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ turcane.cpp:28:24: error: 'm' was not declared in this scope for(int j=1;j<=m;j++) ^ turcane.cpp:31:23: error: 'r' was not declared in this scope int k=r; ^ turcane.cpp:35:55: error: 'p' was not declared in this scope dp[i][j]=min(dp[i][j],1+dp[i][max(1,j-p)]); ^ turcane.cpp:36:52: error: 'q' was not declared in this scope dp[i][j]=min(dp[i][j],1+dp[max(1,i-q)][j]); ^ turcane.cpp:42:14: error: 'n' was not declared in this scope fout<<dp[n][m]-1<<'\n'; ^ turcane.cpp:42:17: error: 'm' was not declared in this scope fout<<dp[n][m]-1<<'\n'; ^ turcane.cpp: In function 'void c2()': turcane.cpp:49:26: error: 'n' was not declared in this scope for (int i = 1; i <= n; i++) ^ turcane.cpp:50:30: error: 'm' was not declared in this scope for (int j = 1; j <= m; j++) ^ turcane.cpp:53:64: error: 'p' was not declared in this scope int sp_linie = sl[i][j - 1] - sl[i][max(0, j - p - 1)]; ^ turcane.cpp:54:63: error: 'q' was not declared in this scope int sp_coloana = sc[i - 1][j] - sc[max(0, i - q - 1)][j]; ^ turcane.cpp:55:69: error: 'r' was not declared in this scope int sp_diagonala = sd[i - 1][j - 1] - sd[max(0, i - r - 1)][max(0, j - r - 1)]; ^ turcane.cpp:56:30: error: 'MOD' was not declared in this scope int cal=(1LL*MOD+dp[max(0,i-2)][max(0,j-1)]+dp[(max(0,i-1))][max(0,j-2)])%MOD; ^ turcane.cpp:60:70: error: expected ')' before ';' token sc[i][j] = (MOD + 1LL * dp[i][j] + sc[i - 1][j] % MOD; ^ turcane.cpp:64:16: error: 'n' was not declared in this scope fout << dp[n][m]; ^ turcane.cpp:64:19: error: 'm' was not declared in this scope fout << dp[n][m]; ^ turcane.cpp: In function 'int main()': turcane.cpp:75:8: error: 'c' was not declared in this scope if(c==1)c1(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Turcane 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ă.