QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#378083#5058. Prof. Pang Earning AusInfinityNSCompile Error//C++171.2kb2024-04-06 00:31:532024-04-06 00:31:53

Judging History

你现在查看的是最新测评结果

  • [2024-04-06 00:31:53]
  • 评测
  • [2024-04-06 00:31:53]
  • 提交

answer

#include<bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()

using namespace std;

vector<ll> x(6);
vector<int> n(2),k(6);
ll ans;
pok(){
    x[0]=(n[0]-x[5]*k[5])/k[0];
    if(x[0]<0)return;
    x[1]=x[0]*k[0]+x[5]*k[5]-x[4];
    if(x[1]<0)return;
    x[2]=(n[1]-x[4]*k[4])/k[2];
    if(x[2]<0)return;
    x[3]=x[2]*k[2]+x[4]*k[4]-x[5];
    if(x[3]<0)return;
    if(x[0]==0&&x[2]==0)return;
    if(x[1]+x[4]>n[0])return;
    if(x[3]+x[5]>n[1])return;
    ans=max(ans,x[1]*k[1]+x[3]*k[3]-x[0]-x[2]);
}
void test(){
    for(int i=0;i<2;i++){
        scanf("%i",&n[i]);
    }
    for(int i=0;i<6;i++){
        scanf("%i",&k[i]);
    }
    ans=0;
    for(x[4]=0;x[4]<=100;x[4]++){
        for(x[5]=0;x[5]<=100;x[5]++){
            pok();
        }
    }
    int mx4=min(n[1]/k[4],n[0]),mx5=min(n[0]/k[5],n[1]);
    for(x[4]=mx4;x[4]>=0&&mx4-x[4]<=100;mx[4]--){
        for(x[5]=mx5;x[5]>=0&&mx5-x[5]<=100;mx[5]--){
            pok();
        }
    }
    printf("%lld\n",ans+1);
}

int main(){
    int t;
    scanf("%i",&t);
    while(t--){
        test();
    }
}

Details

answer.code:15:1: error: ISO C++ forbids declaration of ‘pok’ with no type [-fpermissive]
   15 | pok(){
      | ^~~
answer.code: In function ‘int pok()’:
answer.code:17:15: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   17 |     if(x[0]<0)return;
      |               ^~~~~~
answer.code:19:15: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   19 |     if(x[1]<0)return;
      |               ^~~~~~
answer.code:21:15: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   21 |     if(x[2]<0)return;
      |               ^~~~~~
answer.code:23:15: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   23 |     if(x[3]<0)return;
      |               ^~~~~~
answer.code:24:25: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   24 |     if(x[0]==0&&x[2]==0)return;
      |                         ^~~~~~
answer.code:25:23: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   25 |     if(x[1]+x[4]>n[0])return;
      |                       ^~~~~~
answer.code:26:23: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
   26 |     if(x[3]+x[5]>n[1])return;
      |                       ^~~~~~
answer.code: In function ‘void test()’:
answer.code:43:41: error: ‘mx’ was not declared in this scope; did you mean ‘mx5’?
   43 |     for(x[4]=mx4;x[4]>=0&&mx4-x[4]<=100;mx[4]--){
      |                                         ^~
      |                                         mx5
answer.code: In function ‘int pok()’:
answer.code:27:8: warning: control reaches end of non-void function [-Wreturn-type]
   27 |     ans=max(ans,x[1]*k[1]+x[3]*k[3]-x[0]-x[2]);
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘void test()’:
answer.code:31:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |         scanf("%i",&n[i]);
      |         ~~~~~^~~~~~~~~~~~
answer.code:34:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |         scanf("%i",&k[i]);
      |         ~~~~~^~~~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:53:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   53 |     scanf("%i",&t);
      |     ~~~~~^~~~~~~~~