/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 496.0 KiB
#2 Accepted 2ms 328.0 KiB
#3 Accepted 2ms 528.0 KiB
#4 Accepted 5ms 556.0 KiB
#5 Accepted 22ms 596.0 KiB
#6 Accepted 193ms 1.285 MiB
#7 Accepted 191ms 1.445 MiB
#8 Accepted 195ms 1.387 MiB
#9 Accepted 208ms 1.621 MiB
#10 Accepted 2ms 540.0 KiB

Code

#include<bits/stdc++.h>
#define FileIO          freopen("input.in", "r", stdin); freopen("output.in", "w", stdout)
#define ll              long long
#define input_vec(v)    for(int II=0; II<v.size(); II++) cin >> v[II];
#define sortf(v)        sort(v.begin(), v.end());
#define sortr(v)        sort(v.rbegin(), v.rend());
#define print_vec(v)    for(int II=0; II<v.size(); II++){cout << v[II];} cout << endl;

using namespace std;

void test_case(int tc)
{
    ll n, d;   cin>>n>>d;
    ll a, b;   cin>>a>>b;

    if(d>n) {
        cout << n*a << endl;
    } else {
        cout << (d*a + (n-d)*b) << endl;
    }

    
}

int main()
{
    
    // if(fopen("input.in", "r")) FileIO;
    int n; cin >> n;

    for(int i=0; i<n; i++) test_case(i+1);
}

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 09:06:03
Judged At
2024-10-30 09:06:03
Judged By
Score
100
Total Time
208ms
Peak Memory
1.621 MiB