zoukankan      html  css  js  c++  java
  • zoj 1089 Lotto

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1089

    递归实现的排列组合。

    code:

    #include<cstdio>
    int data[20] ;
    int ans[6], n ;
    void work(int diex, int aiex){
        int i ;
        if(aiex==6){
            for(i=0; i<5; i++)
                printf("%d ", ans[i]) ;
            printf("%d\n", ans[i]) ;
        return ;
        }
        for(i=diex; i<n; i++){
            ans[aiex] = data[i] ;
            work(i+1, aiex+1) ;
        }
    }
    int main(){
        int i, j=0 ;
        while(~scanf("%d", &n)&&n){
            if(j)   printf("\n") ;
            j ++ ;
            for(i=0; i<n; i++)
                scanf("%d", &data[i]) ;
            work(00) ;
        }
        return 0 ;} 
  • 相关阅读:
    deque-pop_back
    deque-max_size
    deque-insert
    deque-insert
    deque-front
    deque-front
    deque-erase
    deque-erase
    deque-end
    Angular2入门教程-1
  • 原文地址:https://www.cnblogs.com/xiaolongchase/p/2443161.html
Copyright © 2011-2022 走看看