3 solutions

  • 0
    @ 2022-4-1 22:49:36
    #include<iostream>
    using namespace std;
    int a[10];
    bool find(int n){
    	while(n){//因为不确定n是多少位只能一位一位的拆分 
    		int N = n%10;//一位一位的拆分拆成0到9十个数 
    		n /= 10;//剩下的数重新赋值 
    		--a[N];
    		if(a[N]<0)
    		return false;
    	}
    	return true; 
    }
    int main(){
    	int num = 0;
    	for(int i=0; i<10; i++){//给0到9十张卡片赋值 
    		a[i] = 2021;
    	}
    	for(int i=1;find(i);i++)//因为从1开始拼凑则直接从1开始遍历
    	    num++;
    	printf("%d\n",num);
    }
    

    Information

    ID
    1557
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    139
    Accepted
    77
    Uploaded By