#197
Combinari
Se citesc două numere naturale nenule n
și k
. Să se afişeze, în ordine lexicografică, submulțimile de câte k
elemente ale mulţimii {1,2,..,n}
.
Problema | Combinari | Operații I/O |
combinari.in /combinari.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53974812 | Utilizator | |
Fișier | combinari.cpp | Dimensiune | 631 B |
Data încărcării | 16 Noiembrie 2024, 13:53 | Scor / rezultat | Eroare de compilare |
combinari.cpp:4:13: warning: character constant too long for its type [enabled by default] ifstream in('combinari.in') ^ combinari.cpp:5:14: warning: character constant too long for its type [enabled by default] ofstream out('combinari.out') ^ combinari.cpp:4:27: error: invalid conversion from 'int' to 'const char*' [-fpermissive] ifstream in('combinari.in') ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:69:0, from combinari.cpp:1: /usr/include/c++/4.8/fstream:467:7: error: initializing argument 1 of 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]' [-fpermissive] basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) ^ combinari.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream out('combinari.out') ^ combinari.cpp: In function 'void afis()': combinari.cpp:10:25: error: 'm' was not declared in this scope for(int i = 1; i <= m; i++) ^ combinari.cpp:11:9: error: 'fout' was not declared in this scope fout << x[i] << " "; ^ combinari.cpp:11:17: error: 'x' was not declared in this scope fout << x[i] << " "; ^ combinari.cpp:12:5: error: 'fout' was not declared in this scope fout << '\n'; ^ combinari.cpp: In function 'bool valid(int)': combinari.cpp:17:12: error: 'x' was not declared in this scope if(x[k] == x[i]) ^ combinari.cpp: In function 'void bk(int)': combinari.cpp:23:25: error: 'n' was not declared in this scope for(int i = 1; i <= n; i++) { ^ combinari.cpp:24:9: error: 'x' was not declared in this scope x[k] = i; ^ combinari.cpp:26:21: error: 'm' was not declared in this scope if(k == m) ^ combinari.cpp:25:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(valid(k)) ^ combinari.cpp: In function 'int main()': combinari.cpp:35:5: error: 'fin' was not declared in this scope fin >> n >> m; ^ combinari.cpp:35:12: error: 'n' was not declared in this scope fin >> n >> m; ^ combinari.cpp:35:17: error: 'm' was not declared in this scope fin >> n >> m; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Combinari 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ă.