Submission #24284085
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define Precision13 cout << fixed << setprecision(13)
const double PI=3.14159265358979323846;
const int MAX = 510000;
const int MOD = 1000000007;
const int INF = 1<<29;
using Graph = vector<vector<ll>>;
int main() {
ll n,a,x,y;
cin >>n >> a>>x>>y;
if(n<=a){
cout << n*x << endl;
}else{
ll ans = a*x+(n-a)*y;
cout << ans << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Cabbages |
| User | takkey |
| Language | C++ (GCC 9.2.1) |
| Score | 100 |
| Code Size | 668 Byte |
| Status | AC |
| Exec Time | 6 ms |
| Memory | 3600 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 6 ms | 3408 KiB |
| 001.txt | AC | 3 ms | 3524 KiB |
| 002.txt | AC | 3 ms | 3600 KiB |
| 003.txt | AC | 2 ms | 3452 KiB |
| 004.txt | AC | 2 ms | 3596 KiB |
| 005.txt | AC | 2 ms | 3600 KiB |
| 006.txt | AC | 2 ms | 3600 KiB |
| 007.txt | AC | 2 ms | 3576 KiB |
| 008.txt | AC | 2 ms | 3448 KiB |
| 009.txt | AC | 3 ms | 3444 KiB |
| example0.txt | AC | 2 ms | 3396 KiB |
| example1.txt | AC | 3 ms | 3552 KiB |