/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 472.0 KiB
#4 Accepted 6ms 548.0 KiB
#5 Accepted 36ms 600.0 KiB
#6 Accepted 337ms 1.402 MiB
#7 Accepted 324ms 1.438 MiB
#8 Accepted 325ms 1.367 MiB
#9 Accepted 324ms 1.348 MiB
#10 Accepted 2ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long n,d;
        cin>>n>>d;
        long long a,b;
        cin>>a>>b;

        long long p=min(n,d);

        long long ans=0;

        ans+=(a*p);

        long long u=n-d;

        if(u>0)
        {
            ans+=(u*b);

        }

        cout<<ans<<endl;
    }
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Brain Booster #5
Language
C++11 (G++ 13.2.0)
Submit At
2024-09-05 15:34:20
Judged At
2024-11-11 03:03:52
Judged By
Score
100
Total Time
337ms
Peak Memory
1.438 MiB