/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 2ms 328.0 KiB
#3 Accepted 2ms 540.0 KiB
#4 Accepted 5ms 328.0 KiB
#5 Accepted 34ms 628.0 KiB
#6 Accepted 327ms 1.438 MiB
#7 Accepted 320ms 1.379 MiB
#8 Accepted 332ms 1.367 MiB
#9 Accepted 326ms 1.418 MiB
#10 Accepted 2ms 332.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-11-11 02:35:39
Judged By
Score
100
Total Time
332ms
Peak Memory
1.438 MiB