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-10-03 13:11:37
- Judged By
- Score
- 100
- Total Time
- 301ms
- Peak Memory
- 1.34 MiB