您的位置:首页 > 理论基础

穷举法解决组合问题1

2016-08-25 22:53 120 查看
/*
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:text.cpp
*作者:汤善晔
*完成日期:2016年8月25日
*版本号:v1.0
 */

#include <iostream>  

using namespace std;  

int main()  

{  

    int x,y,z;  

    for(x=1;x<20;x++)  

    {  

        for(y=1;y<33;y++)  

        {  

            for(z=3;z<100;z+=3)  

                if((x+y+z)==100&& ((x*5+y*3+z/3)==100) && ((x>=1)&&(y>=1)&&(z>=1) ))  

            {  

                  cout <<x,y,z;  

                  cout<<"\n";  

            }  

        }  

    }  

    return 0;  
}  

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c语言 计算机