Cod sursa(job #1709434)

Utilizator CBOSTorinoUPB Andrei Bercaru CBOSTorino Data 28 mai 2016 12:14:43
Problema Twoton Scor 0
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.53 kb
#include <iostream>
#include <fstream>

int n;
int a[1000024];
int count = 0;

int wtf(int i)
{
  count++;
  if (count >= 19997) {
    count -= 19997;
  }
  if (i == n - 1) {
    return a[i];
  }
  if (a[i] < wtf(i + 1)) {
    return a[i];
  } else {
    return wtf(i + 1);
  }
}

int main()
{
  std::ifstream f("twoton.in");
  std::ofstream g("twoton.out");

  f >> n;
  for (int i = 0; i < n; i++) {
    f >> a[i];
  }
  wtf(0);
  g << count << std::endl;

  f.close();
  g.close();

  return 0;
}