![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include<iostream>
#include<map>
#include<string>
using namespace std;
map<string,int>mm;//左边是索引,右边是索引的值
int g[22][22];
int main()
{
int n,tmp,i,p;
char s1[22],s2[22],s3[22]={"Park"};
while(scanf("%d",&n)!=EOF)
{
mm.clear();
tmp=1;
mm[s3]=tmp++;
for(i=1;i<=n;i++)
{
int x,y;
scanf("%s%s%d",s1,s2,&p);
if(mm.find(s1)==mm.end())//如果s1在mm中不存在,则返回mm.end()方法
{
mm[s1]=tmp;
x=tmp++;
}
else
x=mm[s1];
if(mm.find(s2)==mm.end())
{
mm[s2]=tmp;
y=tmp++;
}
else
y=mm[s2];
g[x][y]=g[y][x]=p;
}
}
}