Submission #491902

#TimeUsernameProblemLanguageResultExecution timeMemory
491902HegdahlSequence (BOI14_sequence)C++17
25 / 100
5 ms844 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];
 
  int v;
  if (x == 0) {
    v = 10;
    int cnt = 1;

    while (cnt < k) {
      v = 10*v;
      cnt = 10*cnt + 1;
    }
  } else if (x == 9) {
    v = 9;
    int cnt = 1;
 
    while (cnt < k) {
      v = 10*v - 1;
      cnt = 10*cnt + 1;
    }
  } else {
    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...