趋势 莫名其妙一直输出ERR
查看原帖
趋势 莫名其妙一直输出ERR
1061093
AugustFxx楼主2023/10/2 16:00

~~ 洗了啦 都是WA害的啦 ~~

#include <bits/stdc++.h>
using namespace std;
int n;
int init_in(int a,int b,int c,int d,int e,char g1,char g2,char g3,char g4,string type_c){
	cin>>type_c;
    scanf("%d%c%d%c%d%c%d%c%d",&a,&g1,&b,&g2,&c,&g3,&d,&g4,&e);
    return 0;
}
int main(){
	cin>>n;
	int sc[n][6],result[n];
	for(int i=0;i<n;i++){
		int n1,n2,n3,n4,n5;
		char c1,c2,c3,c4;
		string type;
		init_in(n1,n2,n3,n4,n5,c1,c2,c3,c4,type);
		if(c1!='.'||c2!='.'||c3!='.'||c4!=':'){
			result[i]=-1;
		}
		else {
			if( (n1<255||n1==255) && (n1>0 || n1==0) && (n2<255||n2==255) && (n2>0 || n2==0) && (n3<255||n3==255) && (n3>0 || n3==0) && (n4<255||n4==255) && (n4>0 || n4==0) && (n5<65535||n5==65535) && (n5>0 || n5==0) ){
				if(type=="Server"){
					sc[i][0]=n1;
					sc[i][1]=n2;
					sc[i][2]=n3;
					sc[i][3]=n4;
					sc[i][4]=n5;
					sc[i][5]=i;
					result[i]=-11;
				}
				else{
					for(int j=0;j<i;j++){
						if( n1==sc[j][0] && n2==sc[j][1] && n3==sc[j][2] && n4==sc[j][3] && n5==sc[j][4] ){
							result[i]=j+1;
						} 
						else{
							result[i]=-2;
						}
					}
				}
			}
			else{
				result[i]=-1;
			}
		}
	}
	
	for(int i=0;i<n;i++){
		if(result[i]>0){
			cout<<result[i]<<endl;
		}
		else if(result[i]==-11)cout<<"OK"<<endl;
		else if(result[i]==-1)cout<<"ERR"<<endl;
		else if(result[i]==-2)cout<<"FAIL"<<endl;
	}
	return 0;
}
2023/10/2 16:00
加载中...