#241
Se dau două şiruri a şi b, cu n, respectiv m elemente, numere naturale, ordonate crescător. Să se construiască un al treilea şir, c, care să conţină, în ordine crescătoare, elementele din şirurile a şi b.
| Problema | Interclasare | Operații I/O |
interclasare.in/interclasare.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
| Id soluție | #64934055 | Utilizator | |
| Fișier | interclasare.cpp | Dimensiune | 693 B |
| Data încărcării | 16 Iunie 2026, 16:07 | Scor/rezultat | Eroare de compilare |
interclasare.cpp:5:1: error: expected ‘,’ or ‘;’ before ‘ofstream’ 5 | ofstream fout("interclasare.out") | ^~~~~~~~ interclasare.cpp: In function ‘int main()’: interclasare.cpp:9:10: error: ‘n’ was not declared in this scope 9 | cin>>n; | ^ interclasare.cpp:11:14: error: ‘a’ was not declared in this scope 11 | cin>>a[i]; | ^ interclasare.cpp:10:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for(int i=1;i<=n;i++) | ^~~ interclasare.cpp:12:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 12 | cin>>m; | ^~~ interclasare.cpp:12:14: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 12 | cin>>m; | ^ | tm interclasare.cpp:14:14: error: ‘b’ was not declared in this scope 14 | cin>>b[i]; | ^ interclasare.cpp:13:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 13 | for(int i=1;i<=m;i++) | ^~~ interclasare.cpp:15:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 15 | int i=1,j=1,k=0; | ^~~ interclasare.cpp:17:12: error: ‘a’ was not declared in this scope 17 | if(a[i]<b[j]) | ^ interclasare.cpp:17:17: error: ‘b’ was not declared in this scope 17 | if(a[i]<b[j]) | ^ interclasare.cpp:18:13: error: ‘c’ was not declared in this scope 18 | c[++k]=a[i++]; | ^ interclasare.cpp:20:13: error: ‘c’ was not declared in this scope 20 | c[++k]=b[j++]; | ^ interclasare.cpp:23:9: error: ‘c’ was not declared in this scope 23 | c[++k]=a[i++]; | ^ interclasare.cpp:23:16: error: ‘a’ was not declared in this scope 23 | c[++k]=a[i++]; | ^ interclasare.cpp:22:5: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] 22 | while(i<=n) | ^~~~~ interclasare.cpp:24:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’ 24 | while(j<=m) | ^~~~~ interclasare.cpp:25:13: error: ‘c’ was not declared in this scope 25 | c[++k]=b[j++]; | ^ interclasare.cpp:25:20: error: ‘b’ was not declared in this scope 25 | c[++k]=b[j++]; | ^ interclasare.cpp:27:19: error: ‘c’ was not declared in this scope 27 | cout<<c[i]<<' '; | ^ interclasare.cpp:26:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 26 | for(int i=1;i<=k;i++) | ^~~ interclasare.cpp:28:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 28 | if(i%10==0) | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Interclasare 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ă.