最简洁的代码,没有之一!
查看原帖
最简洁的代码,没有之一!
482095
wangzhih楼主2022/1/1 20:49

STL大法好

#include<bits/stdc++.h>
using namespace std;
int n,q,oper,i,j,k;//oper操作符 
map<int,map<int,int> > a;//"> >"用于防止误判位操作 
int main() {
	cin>>n>>q;
	while(q--){//重复q次 
		cin>>oper>>i>>j;
		if(oper-1) cout<<a[i][j]<<endl;//读 
		else cin>>k,a[i][j]=k;//存
	}
	return 0;
}
2022/1/1 20:49
加载中...