#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a,x,y;
cin>>n>>a>>x>>y;
if(n<=a)cout<<n*x<<endl;
else cout<<a*x+(n-a)*y<<endl;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int l=s.length();
int i;
for(i=0;i<l;i++){
if(s[i]=='1')break;
}
if(i%2==0)cout<<"Takahashi"<<endl;
else cout<<" Aoki"<<endl;
return 0;
}
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n,k;
cin>>n>>k;
ll num[n];
map<ll,ll> mp;
for(ll i=0;i<n;i++){
cin>>num[i];
}
ll max=0;
for(ll i=0;i<k;i++){
mp[num[i]]++;
}
max=mp.size();
for(ll i=0;i<n-k;i++){
//cout<<num[i]<<" "<<num[i+1]<<" "<<num[i+2]<<" "<<" "<<" "<<i<<" "<<mp.size()<<endl;
mp[num[i]]--;
mp[num[i+k]]++;
if(mp[num[i]] == 0) mp.erase(num[i]);
if(mp.size()>max)max=mp.size();
}
cout<<max<<endl;
return 0;
}
map中值为0时不代表整个键值对删除,要使用earse函数删除
mp.erase(num[i]);