Accepted
Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t--){
int n,d;
cin>>n>>d;
int a,b;
cin>>a>>b;
int c=n-d;
if(n<d){
cout<<n*a<<"\n";
}
else{
long long cost=(d*a)+(c*b);
cout<<cost<<"\n";
}
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1090 A. Summer trip
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2025-08-05 16:59:12
- Judged At
- 2025-08-05 16:59:12
- Judged By
- Score
- 100
- Total Time
- 74ms
- Peak Memory
- 1.352 MiB