//
// main.cpp
// activity
//
// Created by 徐伟 on 6/13/16.
// Copyright © 2016 fizz. All rights reserved.
//
#include<iostream>
using namespace std;
int main()
{
int i,j,k,count=0;
for(i=0;i<=100;i++)
for(j=0;j<=50;j++)
for(k=0;k<=20;k++)
{
if(i+j*2+k*5==100)
{
++count;
cout<<"第"<<count<<"种";
cout<<" "<<"1分钱:"<<i;
cout<<" "<<"2分钱:"<<j;
cout<<" "<<"5分钱:"<<k<<endl;
if(count%50==0) //每输出50个方案暂停一次
{
cout<<"按任意键继续输出(找不到任意键打客服电话问询)……"<<endl;
getchar();
}
}
}
return 0;
}
穷举法解决组合问题
最新推荐文章于 2023-10-30 22:35:48 发布