/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 336.0 KiB
#2 Accepted 2ms 332.0 KiB
#3 Accepted 2ms 540.0 KiB
#4 Accepted 3ms 332.0 KiB
#5 Accepted 9ms 652.0 KiB
#6 Accepted 72ms 1.359 MiB
#7 Accepted 69ms 1.367 MiB
#8 Accepted 71ms 1.402 MiB
#9 Accepted 72ms 1.375 MiB
#10 Accepted 2ms 332.0 KiB

Code

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int ll
#define double long double
const int N = 2e5 + 15, MOD = 1e9 + 7;
#define deb(x) cout << #x << "=" << x << endl;
#define F first
#define S second

void solve() {
    int n, d, a, b;
    cin >> n >> d >> a >> b;
    if (n <= d) {
        cout << (n * (a));
        return;
    }
    cout << ((d * a) + ((n - d) * b));


}

signed main() {
    ios_base::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(NULL);
    int tt = 1;
    cin >> tt;
    for (int i = 0; i < tt; i++) {
        // cout << "Case " << i + 1 << ": ";
        solve();
        cout << "\n";
    }
}

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:34:26
Judged At
2024-10-03 13:11:35
Judged By
Score
100
Total Time
72ms
Peak Memory
1.402 MiB