2010年7月22日 星期四

[C/C++] 樂透

// Type : 7 1 2 3 4 5 6 7

#include
int a[20],ans[7],n;
int lotto(int now,int deep)
{
    if(deep==6){
        for(int i=0;i<6;i++)
            printf("%d",ans[i]);
        puts("");
    }
    else{
        for(int i=now;i
            ans[deep]=a[i];
            lotto(i+1,deep+1);
        }
        return 0;
    }

}



main()
{
    while(scanf ("%d",&n)!=EOF){
        for(int i=0;i
            scanf("%d",a+i);
        lotto(0,0);
    }
}

沒有留言:

張貼留言