Accepted
Code
#include <iostream>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int N, D;
cin >> N >> D;
int A, B;
cin >> A >> B;
long long total_cost;
if (N <= D) {
total_cost = 1LL * N * A;
} else {
total_cost = 1LL * D * A + 1LL * (N - D) * B;
}
cout << total_cost << "\n";
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1090 A. Summer trip
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-28 18:16:18
- Judged At
- 2025-07-28 18:16:18
- Judged By
- Score
- 100
- Total Time
- 285ms
- Peak Memory
- 1.426 MiB