/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 2ms 328.0 KiB
#4 Accepted 4ms 320.0 KiB
#5 Accepted 31ms 628.0 KiB
#6 Accepted 298ms 1.266 MiB
#7 Accepted 301ms 1.309 MiB
#8 Accepted 289ms 1.289 MiB
#9 Accepted 285ms 1.34 MiB
#10 Accepted 2ms 532.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-10-03 13:11:37
Judged By
Score
100
Total Time
301ms
Peak Memory
1.34 MiB