/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 484.0 KiB
#3 Accepted 1ms 484.0 KiB
#4 Accepted 2ms 576.0 KiB
#5 Accepted 5ms 532.0 KiB
#6 Accepted 46ms 1.27 MiB
#7 Accepted 41ms 1.27 MiB
#8 Accepted 40ms 1.27 MiB
#9 Accepted 74ms 1.352 MiB
#10 Accepted 1ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
int main(){
     ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin>>t;
    while(t--){
        int n,d;
        cin>>n>>d;
        int a,b;
        cin>>a>>b;
        int c=n-d;
        if(n<d){
            cout<<n*a<<"\n";
        }
        else{
        long long cost=(d*a)+(c*b);
        cout<<cost<<"\n";
        }
    }
}

Information

Submit By
Type
Submission
Problem
P1090 A. Summer trip
Language
C++11 (G++ 13.2.0)
Submit At
2025-08-05 16:59:12
Judged At
2025-08-05 16:59:12
Judged By
Score
100
Total Time
74ms
Peak Memory
1.352 MiB