/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 2ms 332.0 KiB
#3 Accepted 3ms 516.0 KiB
#4 Accepted 6ms 540.0 KiB
#5 Accepted 35ms 584.0 KiB
#6 Accepted 340ms 1.406 MiB
#7 Accepted 350ms 1.273 MiB
#8 Accepted 347ms 1.285 MiB
#9 Accepted 342ms 1.445 MiB
#10 Accepted 2ms 544.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-11-11 03:02:46
Judged By
Score
100
Total Time
350ms
Peak Memory
1.445 MiB