样例过,全WA,求LALAO指点
查看原帖
样例过,全WA,求LALAO指点
760418
not_exist楼主2022/8/17 17:16
#include<bits/stdc++.h>
using namespace std;
//写着玩的
typedef long double ld;
typedef string sg;
typedef long lg;
typedef double de;
typedef char ch;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef bool bl;

//主程序
int main()
{
	int n;
	cin>>n;
	sg x[n];
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++){
		cin>>x[i]>>a[i]>>b[i]>>c[i];
	}
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			if((abs(a[i]-a[j]))<=5&&(abs(b[i]-b[j]))<=5&&(abs(c[i]-c[j]))<=5&&(abs((a[i]+b[i]+c[i])-(a[j]+b[j]+c[j]))<=10)){
				for(int k=0;k<min(x[i].length(),x[j].length());k++){
					if(x[i][k]==x[j][k]){
						continue;
					}else if(x[i][k]>x[j][k]){
						cout<<x[j]<<" "<<x[i]<<endl;
						break;
					}else{
						cout<<x[i]<<" "<<x[j]<<endl;
						break;
					}
				}
			}
		}
	}
	return 0;
}
2022/8/17 17:16
加载中...