/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 320.0 KiB
#2 Accepted 1ms 328.0 KiB
#3 Accepted 1ms 324.0 KiB
#4 Accepted 2ms 408.0 KiB
#5 Accepted 5ms 576.0 KiB
#6 Accepted 40ms 1.387 MiB
#7 Accepted 40ms 1.23 MiB
#8 Accepted 41ms 1.379 MiB
#9 Accepted 40ms 1.27 MiB
#10 Accepted 1ms 320.0 KiB

Code

/**
*   Author : As_Shejan
*   Created: 2024-09-06 17:44:39
**/
#include <bits/stdc++.h>
using namespace std;

#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define vi vector<ll>
#define pi pair<ll, ll>
#define vp vector<pair<ll, ll>>
#define f first
#define sc second
#define all(x) x.begin(), x.end()
#define en   '\n'
#define YES cout << "YES" << en
#define NO cout << "NO" << en
#define yes cout << "Yes" << en
#define no cout << "No" << en
#define fill_number(x, n) setfill('0') << setw(n) << (x)
#define precision_number(x, n) fixed << setprecision(n) << (x)
template <typename T>
T gcd(T a, T b)
{
while (b != 0)
{
int temp = b;
b = a % b;
a = temp;
}
return a;
}
template <typename T>
T lcm(T a, T b)
{
return (a * (b / gcd(a, b)));
}

typedef long long  ll;
typedef unsigned long long ull;
typedef long double lld;



int32_t main()
{
    FastIO;

    ll t;
    cin >> t;
    while(t--)
    {
       ll n, d, a, b;
       cin>>n>>d;
       cin>>a>>b;
       
       ll mn = min(n, d);
       ll x = mn * a;
       ll y = n - mn;
       ll z = y * b;

       cout<<x + z <<en;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-06 12:54:26
Judged At
2024-11-11 02:56:15
Judged By
Score
100
Total Time
41ms
Peak Memory
1.387 MiB