Cod sursa(job #1712909)

Utilizator andreiudilaUdila Andrei andreiudila Data 4 iunie 2016 09:33:42
Problema Twoton Scor 0
Compilator cpp Status done
Runda Arhiva ICPC Marime 0.48 kb
#include <fstream>
using namespace std;
ifstream fin("twoton.in");
ofstream fout("twoton.out");

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()
{
    fin>>n;
    for (int i = 0; i < n; ++i)
    {
        fin>>a[i];
    }

    wtf(0);

    fout<<count;
}