45pts,悬关,求调啊啊啊啊啊

P6188 [NOI Online #1 入门组] 文具订购

wayne_wei @ 2024-07-12 15:12:24

1,3,5,6 WA

8,9,10,11,12,19,20 TLE

有老师,不敢看题解

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,maxa=0,a,b,c;
    cin>>n;
    for(int i=0;i<=(n/7);i++)
    {
        for(int j=0;j<=(n-i*7)/4;j++)
        {
            for(int k=0;k<=(n-i*7-j*4)/3;k++)
            {
                if(7*i+4*j+3*k==n)
                {
                    int maxx=min(i,min(j,k));
                    if(maxx==maxa)
                    {
                        if(i+j+k>a+b+c)
                        {
                            a=i;
                            b=j;
                            c=k;
                        }
                    }
                    else if(maxx>maxa)
                         {
                             maxa=maxx;
                             a=i;
                             b=j;
                             c=k;
                         }
                }
            }
        }
    }
    if(maxa==0)
    {
        cout<<"-1";
        return 0;
    }
    cout<<a<<" "<<b<<" "<<c;
    return 0;
}

by Ted_LightningTechG_ @ 2024-07-12 15:13:28

我只能说你加油


by Ted_LightningTechG_ @ 2024-07-12 15:14:10

只能说你加油


by Ted_LightningTechG_ @ 2024-07-12 15:15:05

能说你加油


by Ted_LightningTechG_ @ 2024-07-12 15:15:15

说你加油


by Ted_LightningTechG_ @ 2024-07-12 15:15:32

你加油


by Ted_LightningTechG_ @ 2024-07-12 15:16:26

加油


by Ted_LightningTechG_ @ 2024-07-12 15:16:37


by wayne_wei @ 2024-07-12 15:17:51

@TedLightningTechG

你说话还有回声的噻?


by kczw @ 2024-07-12 15:25:40

@wayne_wei 代码保证正确性吗


by ABCgfed @ 2024-07-12 15:27:02

@qzhongly 复杂度不对吧


| 下一页