/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 320.0 KiB
#2 Accepted 0ms 284.0 KiB
#3 Accepted 0ms 324.0 KiB
#4 Accepted 1ms 324.0 KiB
#5 Accepted 5ms 548.0 KiB
#6 Accepted 43ms 1.32 MiB
#7 Accepted 46ms 1.199 MiB
#8 Accepted 44ms 1.219 MiB
#9 Accepted 43ms 1.086 MiB
#10 Accepted 1ms 340.0 KiB

Code

#include <stdio.h>

int main() {
    int T; 
    scanf("%d", &T);

    while (T--) {
        int N, D, A, B;
        scanf("%d %d", &N, &D);
        scanf("%d %d", &A, &B);
        
        int total_cost = 0;
        if (N <= D) {
            total_cost = N * A;
        } else{
            total_cost = D * A;
            total_cost += (N - D) * B;
        }

        printf("%d\n", total_cost);
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Brain Booster #5
Language
C99 (GCC 13.2.0)
Submit At
2024-09-05 15:54:44
Judged At
2024-10-03 13:09:53
Judged By
Score
100
Total Time
46ms
Peak Memory
1.32 MiB