1 条题解

  • 1
    @ 2023-4-1 20:06:26
    #include<iostream>
    #include<string.h>
    using namespace std;
    int a,n,cnt;
    bool check(int x,int y){//判断是否重复
    	if(1000>x&&1000>y)return false;
    	int a[10];
    	memset(a,0,sizeof(a));
    	while(x){
    		if(a[x%10]==0)a[x%10]++;
    		else return false;
    		x/=10;
    	}
    	while(y){
    		if(a[y%10]==0)a[y%10]++;
    		else return false;
    		y/=10;
    	}
    	return true;
    }
    int main(){
    	cin>>n;
    	for(int i=1000;i<=n-1023;i++){
    		a=n-i;
    		if(check(i,a)){
    			cout<<i<<" "<<a<<endl;
    			cnt++;
    		}
    	}
    	cout<<cnt;
    	return 0;
    }
    
    • 1

    信息

    ID
    968
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    15
    已通过
    12
    上传者