QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#378081#5058. Prof. Pang Earning AusInfinityNSRE 0ms0kbC++171.1kb2024-04-06 00:28:212024-04-06 00:28:22

Judging History

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

  • [2024-04-06 00:28:22]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-04-06 00:28:21]
  • 提交

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);
void test(){
    for(int i=0;i<2;i++){
        scanf("%i",&n[i]);
    }
    for(int i=0;i<6;i++){
        scanf("%i",&k[i]);
    }
    ll ans=0;
    for(x[4]=0;x[4]<=100;x[4]++){
        for(x[5]=0;x[5]<=100;x[5]++){
            x[0]=(n[0]-x[5]*k[5])/k[0];
            if(x[0]<0)continue;
            x[1]=x[0]*k[0]+x[5]*k[5]-x[4];
            if(x[1]<0)continue;
            x[2]=(n[1]-x[4]*k[4])/k[2];
            if(x[2]<0)continue;
            x[3]=x[2]*k[2]+x[4]*k[4]-x[5];
            if(x[3]<0)continue;
            if(x[0]==0&&x[2]==0)continue;
            if(x[1]+x[4]>n[0])continue;
            if(x[3]+x[5]>n[1])continue;
            ans=max(ans,x[1]*k[1]+x[3]*k[3]-x[0]-x[2]);
        }
    }
    printf("%lld\n",ans+1);
}

int main(){
    freopen("in.txt","r",stdin);
    int t;
    scanf("%i",&t);
    while(t--){
        test();
    }
}

详细

Test #1:

score: 0
Runtime Error

input:

6
2 2 2 2 2 2 2 2
78 74 5 3 10 2 4 7
31 75 3 6 6 1 8 4
91 86 4 2 9 5 8 5
48 89 3 9 2 3 5 7
13 25 5 7 6 1 2 4

output:


result: