/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Accepted 1ms 360.0 KiB
#3 Accepted 1ms 400.0 KiB
#4 Accepted 2ms 284.0 KiB
#5 Accepted 8ms 524.0 KiB
#6 Accepted 97ms 1.098 MiB
#7 Accepted 44ms 1.23 MiB
#8 Accepted 44ms 1.27 MiB
#9 Accepted 44ms 1.27 MiB
#10 Accepted 0ms 284.0 KiB

Code

#include <stdio.h>
int main(){
int T;
scanf("%d",&T);

while (T--) {
        int N, D;  
        int A, B;
        scanf("%d %d", &N, &D);
        scanf("%d %d", &A, &B);

        long long total_cost;
        if (N <= D) {
        total_cost = (long long)N * A;
        }
        else {
        total_cost = (long long)D * A + (long long)(N - D) * B;
        }
        printf("%lld\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 16:15:07
Judged At
2024-09-05 16:15:07
Judged By
Score
100
Total Time
97ms
Peak Memory
1.27 MiB