📜  map.count() 在 C++ 代码示例中返回什么

📅  最后修改于: 2022-03-11 14:44:53.353000             🧑  作者: Mango

代码示例1
int n; cin>>n;
long val;
map mp3;
long long res=0;
while(n--){
    cin>>val;
    if(mp3.count(val))     res+=mp3[val]; 
    //mp3.count(val) returns 1 if val is present in the map already or 
    //the number of times the key K is present in the map container.
    if(mp2.count(val))     mp3[val*r]+=mp2[val];
    mp2[val*r]++;
}
cout<