UVA Solution 441 – Lotto – Solution in C, C++
UVA Online Judge Solution 441 – Lotto| Volume 4
UVA Problem Link – https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=382
Problem Name: 441 – Lotto
Problem Number : UVA – 441 – Lotto
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C, C plus plus
UVA Solution 441 – Lotto Code in C/PP:
#include <stdio.h>
int n, A[13], ans[6];
void dfs(int idx, int i) {
if(idx == 6) {
printf("%d", ans[0]);
for(i = 1; i < 6; i++)
printf(" %d", ans[i]);
puts("");
return;
}
for(; i < n; i++)
ans[idx] = A[i], dfs(idx+1, i+1);
}
int main() {
int first = 1, i;
while(scanf("%d", &n) == 1 && n) {
if(!first)
puts("");
first = 0;
for(i = 0; i < n; i++)
scanf("%d", A+i);
dfs(0, 0);
}
return 0;
}
Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA Lotto code in C, UVA 441 code in C++, UVA 441 solution in C, UVA Lotto solution