/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 2ms 492.0 KiB
#4 Accepted 3ms 540.0 KiB
#5 Accepted 20ms 540.0 KiB
#6 Accepted 213ms 1.219 MiB
#7 Accepted 211ms 1.27 MiB
#8 Accepted 198ms 1.316 MiB
#9 Accepted 196ms 1.34 MiB
#10 Accepted 2ms 560.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
    ll n,d,a,b;
    cin>>n>>d>>a>>b;

    if(n<=d){
        cout<<a*n<<endl;
    }
    else{
        ll x=n-d;
        ll cost=x*b+d*a;
        cout<<cost<<endl;
    }
}

int main()
{
    int n;
    cin>>n;

    while(n--){
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Sylhet ICPC 2024 Collaborative Challenge: Episode 2
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 08:49:50
Judged At
2024-10-30 08:49:50
Judged By
Score
100
Total Time
213ms
Peak Memory
1.34 MiB