1 solutions

  • 0
    @ 2025-3-3 16:29:40

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    map<string,double> m;
    int main(){
    	int n,i;
    	string name;
    	double val;
    	
    	//读入
    	cin>>n;
    	for(i = 0;i < n;i++){
    		cin>>name>>val;
    		//如果名字没出现过,也就是第一次出现 
    		if(m.count(name) == 0){
    			m[name] = val * 0.75;
    		}else{
    			m[name] = m[name] + val;
    		}
    	}
    	
    	//遍历
    	for(map<string,double>::iterator j = m.begin();j != m.end();j++){
    		cout<<j->first<<" "<<fixed<<setprecision(1)<<j->second<<endl;
    	} 
    	
    }
    
    
    • 1

    Information

    ID
    10272
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By