2 条题解

  • 2
    @ 2024-11-10 16:07:10
    # include<bits/stdc++.h>
    using namespace std;
    map<int,int> m;
    int main(){
    	int n;
    	cin>>n;
    	for(int i=1;i<=n;i++){
    		int x;
    		cin>>x;
    		auto t=m.find(x);
    		if(t!=m.end()){
    			t->second++;
    		}
    		else{
    			m.insert(make_pair(x,1));
    		}
    	}
    	for(auto t=m.begin();t!=m.end();t++){
    		cout<<t->first<<" "<<t->second<<endl;
    	}
    	return 0;
    }
    
    

    信息

    ID
    246
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    24
    已通过
    13
    上传者