Cod sursa(job #620124)
| Utilizator | Data | 16 octombrie 2011 12:17:12 | |
|---|---|---|---|
| Problema | Combinari | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.37 kb |
#include<fstream>
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
int st[100],n,m;
void scrie() {
for(int i=1;i<=m;i++) fout<<st[i]<<" ";
fout<<"\n";
}
void bk(int k) {
if(k==m+1) scrie();
else {
st[k]=st[k-1];
while(st[k]<n) {
st[k]++;
bk(k+1);
}
}
}
int main() {
fin>>n>>m;
bk(1);
return 0;
}
