CE?
  • 板块学术版
  • 楼主scj_juruo
  • 当前回复1
  • 已保存回复1
  • 发布时间2023/1/1 22:12
  • 上次更新2023/10/24 05:51:38
查看原帖
CE?
805551
scj_juruo楼主2023/1/1 22:12

第二十三行报错。

#include <bits/stdc++.h>
using namespace std;
int n;
map<string,pair<int,int> >xy;
vector<string>v;
map<string,double>dis;
map<string,int>m; 
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	for(int t=1;t<=n;t++)
	{
		string op,str;
		int x,y;
		cin>>op;
		if(op=="new")
		{
			string str,x,y;
			cin>>str>>x>>y;
			if(m[str]==0)
			{
				xy[str]=make_pair(x,y); 
				v.push_back(str);
				dis[str]=0;
				m[str]=1;
			}
			else
				cout<<"Invaild Command"<<endl;
		}
		else if(op=="move")
		{
			cin>>str>>x>>y;
			if(m[str]==0)
				cout<<"Invild Command"<<endl;
			else
				dis[str]+=sqrt(abs(xy[str].first-x)*abs(xy[str].first-x)+abs(xy[str].second-y)*abs(xy[str].second-y));
		}
		else if(op=="del")
		{
			cin>>str;
			if(m[str]==0)
				cout<<"Invaild Command"<<endl;
			else
				m[str]=0;
		}
		else if(op=="querydis")
		{
			cin>>str;
			if(m[str])
				cout<<fixed<<setprecision(5)<<dis[str]<<endl;
			else
				cout<<"Invaild Command"<<endl;
		}
		else if(op=="list")
		{
			for(int i=0;i<v.size();i++)
				if(m[v[i]])
					cout<<v[i]<<endl;
		}
		else
			cout<<"Hocus Pocus,Abrakadabra!Do you confirm that Santa Claus is real?"<<endl;
	}
	return 0;
}
2023/1/1 22:12
加载中...