Submission #1140944

#TimeUsernameProblemLanguageResultExecution timeMemory
1140944dpsaveslivesSequence (BOI14_sequence)C++20
25 / 100
3 ms584 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int K; cin >> K;
    vector<int> arr(K);
    for(int i = 0;i<K;++i) cin >> arr[i];
    if(arr[0] == 0){
        int x = 1, ans = 10;
        while(x < K){
            x *= 10;
            ++x;
            ans *= 10;
        }
        cout << ans << "\n";
        return 0;
    }
    else if(arr[0] == 9){
        int x = 1, ans = 8;
        while(x < K){
            x *= 10;
            ++x;
            ans *= 10;
            ans += 8;
        }
        ++ans;
        cout << ans << "\n";
        return 0;
    }
    int x = 1;
    while(K > x){
        x *= 10;
    }
    x *= arr[0];
    cout << x << "\n";
    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...