Accepted
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