Pagini recente » Cod sursa (job #3260305) | Cod sursa (job #1577773) | Cod sursa (job #3039286) | Cod sursa (job #1681125) | Cod sursa (job #1709290)
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int n;
int a[1000024], b[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()
{
FILE *fin = fopen("twoton.in", "r");
FILE *fout = fopen("twoton.out", "w");
fscanf(fin, "%d", &n);
for (int i = 0; i < n; ++i)
fscanf(fin, "%d", &a[i]);
int i;
b[n - 1] = 1;
for (i = n - 2; i >= 0; i--)
{
if (a[i] >= a[i + 1])
{
b[i] = 1 + b[i + 1] + b[i + 1];
a[i] = a[i + 1];
}
else b[i] = 1 + b[i + 1];
}
fprintf(fout, "%d\n", b[0]);
fclose(fin);
fclose(fout);
}