文章

81

粉丝

2

获赞

544

访问

18.1k

头像
百鸡问题 题解:
P1348 哈尔滨工业大学机试
发布于2026年3月16日 23:36
阅读数 256

#include <iostream>
using namespace std;

int main(){
    int n;

    while(cin >> n){
        for(int x = 0; x <= 100; x++){
            for(int y = 0; y <= 100; y++){
                int z = 100 - x - y;

                if(z < 0) continue;

                if(5 * x + 3 * y + z / 3.0 <= n){
                    cout << "x=" << x
                         << ",y=" << y
                         << ",z=" << z << endl;
                }
            }
        }
    }
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发