/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 2ms 524.0 KiB
#4 Accepted 4ms 548.0 KiB
#5 Accepted 29ms 532.0 KiB
#6 Accepted 262ms 1.23 MiB
#7 Accepted 264ms 1.34 MiB
#8 Accepted 268ms 1.297 MiB
#9 Accepted 268ms 1.445 MiB
#10 Accepted 1ms 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-09-05 15:48:08
Judged By
Score
100
Total Time
268ms
Peak Memory
1.445 MiB