zoukankan      html  css  js  c++  java
  • C

    题目链接

    题目思路

    这个题目好玄学感觉是分治+爆搜的题目

    建议直接看官方题解 分治秒的一批

    代码

    #include<bits/stdc++.h>
    #define fi first
    #define se second
    #define debug cout<<"I AM HERE"<<endl;
    using namespace std;
    typedef long long ll;
    const int maxn=2e5+5,inf=0x3f3f3f3f,mod=1e9+7;
    const double eps=1e-6;
    ll n;
    unordered_map<ll,int> mp;
    int cal(ll n){
        if(mp.count(n)) return mp[n];
        int ans=-1;
        for(int k=1;k<=n;k++){
            for(int i=k;i<=3*k;i++){
                if((n-i)%10==0){
                    if(cal((n-i)/10)<=k){
                        ans=k;
                        break;
                    }
                }
            }
            if(ans!=-1) break;
        }
    }
    signed main(){
        int _;scanf("%d",&_);
        while(_--){
            scanf("%lld",&n);
            printf("%d
    ",cal(n));
        }
        return 0;
    }
    
    
    
    不摆烂了,写题
  • 相关阅读:
    tablespaces
    转 房价
    Duplicate a whole line in Vim
    Dubbo+JStorm
    replace all
    ORACLE 最后表数据更新的时间
    list reverse
    python IDE
    string 方法
    java JIT AOT
  • 原文地址:https://www.cnblogs.com/hunxuewangzi/p/15131360.html
Copyright © 2011-2022 走看看