打印

[原创] 一道经典的C++题,关于分钱的问题,适合新手阅读

有点像百鸡问题。

TOP

是不是~~~

是不是541种啊~~~~~~~~~~~~~~~
ding
顶你
好东西

TOP

看看阿  正好在学习编程的阿666666666666666666666666666666666666666666
看看                  .

TOP

呵呵,有点意思,正学习中,添加一个,return 0;
呵呵
不会~~~~~~~~~~~~~~~~~~~~

TOP

  

看看
进来,看一下!

TOP

#include <iostream.h>
#define N 10
void main()
{
int one,two,three;
int num=0,q=0;
cout<<"一分\t"<<"二分\t"<<"三分\t"<<endl;
for(one=0;one<=10;one++)
  for(two=0;two<=5;two++)
   for(three=0;three<=2;three++)
   {
    num=one+two+three;
    if(num==N)
    {
     q++;
     cout<<one<<"\t"<<two<<"\t"<<three<<endl;
    }
   }
   cout<<"共有"<<q<<"种分法"<<endl;}
这是答案? 兄弟,你数学没学好啊!!

Processed in 0.021553 second(s), 5 queries, Gzip enabled