/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 2ms 532.0 KiB
#3 Accepted 2ms 352.0 KiB
#4 Accepted 4ms 552.0 KiB
#5 Accepted 31ms 576.0 KiB
#6 Accepted 299ms 1.301 MiB
#7 Accepted 300ms 1.41 MiB
#8 Accepted 284ms 1.289 MiB
#9 Accepted 287ms 1.223 MiB
#10 Accepted 2ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back

void judge()
{
  #ifndef ONLINE_JUDGE
  freopen("error.txt", "w", stderr);
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
 
}

const ll N=2e5 +5;

void soln(){
	int n,d;
	cin>>n>>d;
	int a,b;
	cin>>a>>b;
	ll ans;
	if(n>=d){
		 ans=(d*a)+((n-d)*b);
	}
	else
		 ans=n*a;
	
	cout<<ans<<endl;
}

int main() {
	//judge();
    int t;
    cin >> t;

    while (t--) soln();
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Brain Booster #5
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 15:48:08
Judged At
2024-10-03 13:10:20
Judged By
Score
100
Total Time
300ms
Peak Memory
1.41 MiB