返回题解分享
讨论 / 题解分享/ 帖子详情

卡片(结果填空) - 题解

#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
    int a[10] = {2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021};
    
    int res = 0, i = 1;
    while(true)
    {
        bool flag = true;
        int temp = i;  
        while(temp)
        {
            if(a[temp%10] == 0)
            {
                flag = false;
                break;
            }
            a[temp % 10]--;
            temp /= 10;
        }
        if(flag)
        {
            res++;
            i++;
        }
        else
        {
            break;
        }
    }
    cout << res;
    return 0;
}


0 回复 0 转发 0 喜欢 2 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!