088.马克思手稿中的数学题

简介: 088.马克思手稿中的数学题
#include<stdio.h>
void main()
{
    int x,y,z,count=0;
    clrscr();
    puts("****************************************************************");
    puts("*  This program is to solve an interesting math question in    *");
    puts("*                  Karl Marx's manuscript.                     *");
    puts("* The Problem is as follows: 30 persons spent 50 yuan in a     *");
    puts("* restaurant, amony them, each man spent 3 yuan, each woman    *");
    puts("* spent 2 yuan, and each child spent 1 yuan. The question is   *");
    puts("* how many men, women and children are there?                  *");
    puts("****************************************************************");
    puts(" >> The solutions are:");
    printf("   No.        Men       Women     Children\n");
    printf("---------------------------------------------\n");
    for(x=0;x<=10;x++)
    {
        y=20-2*x;                     /*x定值据(3)式求y*/
        z=30-x-y;                     /*由(1)式求z*/
        if(3*x+2*y+z==50)             /*当前得到的一组解是否满足式(2)*/
      printf(" <%2d>    |    %2d    |    %2d    |    %2d\n",++count,x,y,z);
    }
    printf("---------------------------------------------\n");
    printf(" Press any key to quit...");
    getch();
}
相关文章
|
1月前
|
C语言
每天一道C语言编程练习(5):尼科彻斯定理
每天一道C语言编程练习(5):尼科彻斯定理
21 0
|
11月前
|
决策智能
博弈论第十八集总结(“最后通牒和讨价还价”的观后感)
博弈论第十八集总结(“最后通牒和讨价还价”的观后感)
160 0
【每日一道智力题】之 药瓶毒鼠鼠
【每日一道智力题】之 药瓶毒鼠鼠
139 0
|
并行计算 C++
这道小学六年级的数学题,恕我直言没几个人会做
这道小学六年级的数学题,恕我直言没几个人会做
304 0
|
机器学习/深度学习 人工智能
把所有的谎言献给你β(找规律数学题)
梓川咲太的面前坐着野兔先辈,作为约定,只好乖乖的打开笔记本开始学习了。 “加法符号写歪了,变成了乘法符号,在算式的第三行那个地方。”樱岛麻衣突然开口。
120 0
把所有的谎言献给你β(找规律数学题)
086.爱因斯坦的数学题
086.爱因斯坦的数学题
78 0
|
数据可视化 Python
一个关于 += 的谜题
一个关于 += 的谜题
127 0
一个关于 += 的谜题
再学一道算法题: 寻找大富翁
再学一道算法题: 寻找大富翁
【智力题】新数字游戏
两人轮流说出1到10之间的自然数,并且依次相加,先加到100的胜。请问你该怎么说?解析:反推法。假设最后一步我加到100。      我——>100      他——>90-99      我——>89      他——>79-88      我——>78      他——...
1067 0