#include<bits/stdc++.h>
using namespace std;
int n;
string name;
char s[10000];
map<string,long long>mp;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>name;
int a=-1,b=-1,c=-1,d=-1,e=-1;
int t=sscanf(s,"%d.%d.%d.%d:%d",&a,&b,&c,&d,&e);
if(t!=5||a<0||a>255||b<0||b>255||c<0||c>255||d<0||d>255||e<0||e>65535){
cout<<"ERR"<<endl;
continue;
}else if(name[0]=='S'){
if(mp[s]){
cout<<"FALL"<<endl;
continue;
}
mp[s]=i;
cout<<"OK";
}else if(name[0]=='C'){
if(!mp[s]){
cout<<"FALL"<<endl;
continue;
}
cout<<mp[s];
}
}
return 0;
}
输入:
5
Server 192.168.1.1:8080
Server 192.168.1.1:8080
Client 192.168.1.1:8080
Client 192.168.1.1:80
Client 192.168.1.1:99999
运行:
5
Server 192.168.1.1:8080
ERR
ERR
Server 192.168.1.1:8080
ERR
ERR
Client 192.168.1.1:8080
ERR
三台计算机去那了? 为什么消失了?