/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 496.0 KiB
#2 Accepted 2ms 352.0 KiB
#3 Accepted 2ms 520.0 KiB
#4 Accepted 3ms 328.0 KiB
#5 Accepted 10ms 608.0 KiB
#6 Accepted 71ms 1.281 MiB
#7 Accepted 82ms 1.352 MiB
#8 Accepted 75ms 1.469 MiB
#9 Accepted 78ms 1.363 MiB
#10 Accepted 2ms 500.0 KiB

Code

/* SRIJON
        SINGHA
            SAMANTA */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define nl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define yes cout << "YES" << nl
#define no cout << "NO" << nl
#define fi first
#define sec second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define FIO                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
const int mod = 1e9 + 7;

int32_t main()
{
    FIO

    ll t;	cin>>t;
    ll tt=t;
    while (tt--)
    {
        ll n,d; cin>>n>>d;
        ll a,b; cin>>a>>b;
        ll ans=min(n,d)*a;
        if(d<n) ans+=(n-d)*b;
        cout<<ans<<nl;      
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Sylhet ICPC 2024 Collaborative Challenge: Episode 2
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 08:49:36
Judged At
2024-11-11 02:35:40
Judged By
Score
100
Total Time
82ms
Peak Memory
1.469 MiB