/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 2ms 512.0 KiB
#4 Accepted 3ms 540.0 KiB
#5 Accepted 22ms 608.0 KiB
#6 Accepted 189ms 1.234 MiB
#7 Accepted 190ms 1.273 MiB
#8 Accepted 287ms 1.441 MiB
#9 Accepted 321ms 1.371 MiB
#10 Accepted 2ms 332.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-09-05 15:34:20
Judged By
Score
100
Total Time
321ms
Peak Memory
1.441 MiB