/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 340.0 KiB
#2 Accepted 1ms 320.0 KiB
#3 Accepted 1ms 392.0 KiB
#4 Accepted 2ms 536.0 KiB
#5 Accepted 6ms 564.0 KiB
#6 Accepted 42ms 1.414 MiB
#7 Accepted 39ms 1.27 MiB
#8 Accepted 40ms 1.281 MiB
#9 Accepted 40ms 1.418 MiB
#10 Accepted 1ms 324.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

#define int long long

void solve() {
    int n, d, a, b;
    cin >> n >> d >> a >> b;
    int ans = min(d, n) * a + max(0LL, n - d) * b;
    cout << ans << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Language
C++20 (G++ 13.2.0)
Submit At
2024-10-03 08:58:34
Judged At
2024-11-11 02:51:30
Judged By
Score
100
Total Time
42ms
Peak Memory
1.418 MiB