文章

17

粉丝

0

获赞

5

访问

1.3k

头像
百鸡问题 题解:
P1348 哈尔滨工业大学机试
发布于2025年5月30日 17:30
阅读数 11

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//提高时间复杂度的代价就是牺牲空间复杂度来排序 
//加速为O(n2),不加速则是O(n3) 

struct Triple{
    int x,y,z;
}T;

bool cmp(Triple a,Triple b){
    if(a.x!=b.x)    return a.x<b.x;
    else    return a.y<b.y;
}

int main(){
    int n;
    vector<Triple> vec;
    while(cin>>n){
        vec.clear();
        for(int i=100;i>=0;i--){
            for(int j=100-i;j>=0;j--){
                    if(i+j*9+(100-i-j)*15<=3*n)    {
                        Triple a;
 &n...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发