/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 336.0 KiB
#4 Accepted 5ms 368.0 KiB
#5 Accepted 20ms 540.0 KiB
#6 Accepted 289ms 1.422 MiB
#7 Accepted 227ms 1.41 MiB
#8 Accepted 194ms 1.25 MiB
#9 Accepted 193ms 1.398 MiB
#10 Accepted 2ms 540.0 KiB

Code

/*
 *   Copyright (c) 2024 Emon Thakur
 *   All rights reserved.
 */
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int t; cin >> t; while(t--)
    {
        ll n,d; cin >> n >> d;
        ll a,b; cin >> a >> b;
        ll ans = a*min(d,n) + max(n-d,0ll)*b;
        cout << ans << endl;
    }
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-21 10:19:10
Judged At
2024-08-21 10:19:10
Judged By
Score
100
Total Time
289ms
Peak Memory
1.422 MiB