1 2 | #include <cstdio> void g(int s[],int p,int k,int t[],int q=0,int r=0){if(q==k){for(int i=0;i<k;i++)printf("%d ",t[i]);printf("\n");}else{for(int i=r;i<p;i++){t[q]=s[i];g(s,p,k,t,q+1,i+1);}}}main(){int s[]={1,2,3,4,5},t[5];g(s,5,3,t);} |
I2luY2x1ZGUgPGNzdGRpbz4Kdm9pZCBnKGludCBzW10saW50IHAsaW50IGssaW50IHRbXSxpbnQgcT0wLGludCByPTApe2lmKHE9PWspe2ZvcihpbnQgaT0wO2k8aztpKyspcHJpbnRmKCIlZCAiLHRbaV0pO3ByaW50ZigiXG4iKTt9ZWxzZXtmb3IoaW50IGk9cjtpPHA7aSsrKXt0W3FdPXNbaV07ZyhzLHAsayx0LHErMSxpKzEpO319fW1haW4oKXtpbnQgc1tdPXsxLDIsMyw0LDV9LHRbNV07ZyhzLDUsMyx0KTt9
prog.cpp:2: warning: ISO C++ forbids declaration of ‘main’ with no type
-
upload with new input
-
result: Success time: 0s memory: 2724 kB returned value: 0
1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5 3 4 5


