Uva Foreign Exchange map 映射
来源:互联网 发布:it软件测试工程师 编辑:程序博客网 时间:2024/05/12 03:50
//注意每两个城市之间有两条有向边,城市可以为奇数比如说五个
//遍历map使用迭代,it->first,it->second
//啃了两个半小时,处理细节
#include<iostream>
#include<cstdio>
#include<set>
#include<vector>
#include<map>
using namespace std;
map<int,map<int,int> > mp;
int main(){
int a,b,c;
while(cin>>a&&a){
mp.clear();
for(int i=0;i<a;i++){
cin>>b>>c;
int jud=0;
if(mp[c].count(b)&&mp[c][b]!=0){
mp[c][b]--;
jud=1;
}
if(!mp[b].count(c))
mp[b][c]=0;
if(!jud) mp[b][c]++;
}
for(map<int,map<int,int> >::iterator it=mp.begin();it!=mp.end();it++){
map<int,int> it1=it->second;
for(map<int,int>::iterator it2=it1.begin();it2!=it1.end();it2++){
if(it2->second!=0){
cout<<"NO"<<endl;
goto label;
}
}
}
cout<<"YES"<<endl;
label:;
}
return 0;
}
- Uva Foreign Exchange map 映射
- UVa 10763 Foreign Exchange (map的应用)
- UVa 10763 - Foreign Exchange
- UVa 10763 - Foreign Exchange
- uva 10763 - Foreign Exchange
- uva 10763 - Foreign Exchange
- Foreign Exchange uva 10763
- UVa 10763 - Foreign Exchange
- Uva-10763-Foreign Exchange
- UVa 10763 - Foreign Exchange
- UVa 10763 - Foreign Exchange
- UVa 10763: Foreign Exchange
- UVA 10763 Foreign Exchange
- UVa 10763 - Foreign Exchange
- uva 10763 - Foreign Exchange
- uva 10763 Foreign Exchange
- uva 10763 Foreign Exchange
- uva 10763 Foreign Exchange
- Visual Studio Linker Warning LNK4099
- CentOS权限系统恢复/修复办法
- 国内首个网络安全行业全景图重磅推出
- 数据库优化
- 寻找模质数意义下的二次剩余与三次剩余
- Uva Foreign Exchange map 映射
- Matlab将元胞数组输出到txt或者dat文件中
- sverlt Struts 生命周期
- 智障题 Uva Patties
- RGB数据保存为BMP图片
- HTML+CSS(1)
- 也说说MVC如何防盗链
- 一款游戏的背包数据非常规查找处理方法
- #勉励#一旦开始,就不轻易停下