/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 548.0 KiB
#3 Accepted 1ms 452.0 KiB
#4 Accepted 2ms 552.0 KiB
#5 Accepted 6ms 656.0 KiB
#6 Accepted 42ms 1.309 MiB
#7 Accepted 42ms 1.352 MiB
#8 Accepted 43ms 1.453 MiB
#9 Accepted 43ms 1.355 MiB
#10 Accepted 1ms 324.0 KiB

Code

#include <bits/stdc++.h>

using namespace std;
using i64 = long long;

void solve() {
    int n, d; cin >> n >> d;
    int x, y; cin >> x >> y;
    cout << min(d, n) * x + max(n - d, 0) * y << '\n';
}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int T; cin >> T;
    while(T--) solve();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 17:22:03
Judged At
2024-11-11 02:46:20
Judged By
Score
100
Total Time
43ms
Peak Memory
1.453 MiB