Submission #418454

#TimeUsernameProblemLanguageResultExecution timeMemory
418454DJeniUpSequence (BOI14_sequence)C++17
0 / 100
3 ms204 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll>pairll;
typedef pair<ll,pairll>pairlll;
typedef pair<pairll,ll>pairllL;
typedef pair<pairll,pairll>pairllll;
typedef pair<ll,pairllll>pairlllll;
typedef long double ld;
typedef pair<ll,string>pairls;

#define endl '\n'
#define INF 100000000007
#define M 1000000000
#define P 316
#define MOD 998244353
#define pb push_back
#define fr first
#define sc second

ll k,d,res,r;

int main()
{
    cin>>k;
    for(int i=1;i<=k;i++){
        cin>>d;
    }
    k--;
    if(d==9){
        res=9;
        r=10;
        while(res+k>=r){
            res+=8*r;
            r*=10;
        }
        cout<<res<<endl;
        return 0;
    }
    if(d==0){
        d=10;
    }
    res=d;
    r=0;
    while(res+k>=(res/d)*(d+1)){
        res*=10;
    }
    cout<<res<<endl;

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...