1092 To Buy or Not to Buy (20 分)
作者:互联网
水题~。
注意:商店每串珠子都不拆开售卖,只能整串购买。
map<char,int> mpa,mpb;
string a,b;
int main()
{
cin>>a>>b;
for(auto t:a) mpa[t]++;
for(auto t:b) mpb[t]++;
int buy=0,miss=0;
for(auto t:mpb)
{
if(t.se > mpa[t.fi])
miss+=t.se-mpa[t.fi];
}
if(!miss) cout<<"Yes"<<' '<<a.size()-b.size()<<endl;
else cout<<"No"<<' '<<miss<<endl;
//system("pause");
return 0;
}
标签:Buy,mpb,1092,mpa,int,auto,20,miss 来源: https://www.cnblogs.com/fxh0707/p/14409438.html