题解 | #百钱买百鸡问题#

百钱买百鸡问题

https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b

/*
 * @Description: If you get question about the code, contact me at **********.
 * @Author: pengjunxing
 * @Date: 2023-02-10 20:05:28
 * @LastEditors: pengjunxing
 * @LastEditTime: 2023-02-10 20:29:36
 */
#include<iostream>
using namespace std;
int main()
{
    cin.get();
    for(int i =0;i<=100;i++)
    {
        for(int j = 0;j<=100;j++)
        {
            for(double k =0;k<=100;k++)
            {
                double sum=i*5+j*3+k/3;
                if((sum==100)&&(i+j+k)==100)
                {
                    cout<<i<<" "<<j<<" "<<k<<endl;
                }
            }
        }
    }
}

全部评论

相关推荐

码农索隆:竞争压力小,就你一个不用卷
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务