Submission #491900

#TimeUsernameProblemLanguageResultExecution timeMemory
491900HegdahlSequence (BOI14_sequence)C++17
0 / 100
1 ms332 KiB
#include <iostream>
#include <vector>
 
int main() {
  std::cin.tie(0)->sync_with_stdio(0);
 
  int k;
  std::cin >> k;
  std::vector<int> a(k);
  for (int &x : a)
    std::cin >> x;
 
  int x = a[0];
  if (x == 0) x = 10;

  if (x == 9) {
    int v = 9;
    int cnt = 1;
 
    while (cnt < k) {
      v = 10*v - 1;
      cnt = 10*cnt + 1;
    }
 
    std::cout << v << '\n';
  } else {
    int v = x;
    int cnt = 1;
    while (cnt < k) {
      v = 10*v;
      cnt = 10*cnt;
    }
 
    std::cout << v << '\n';
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...