int t; int i = 0; while (n - i){ if (std::cin >> t){ a[i++] = t; } }
// Находим и выводим. n--; int max = -1; for (i = n-1; i >= 0; --i){ if (a[i] > *a && a[i] < a[n]){ max = i; break; } } std::cout << max+1 << std::endl; delete [] a;
Uses GraphABC; var y, i, x, j, x1, y1: integer; begin moveto(0,320); lineto(2000,320); Line(120,100,80,140); Line(120,100,160,140); Line(120,160,80,200); Line(120,160,160,200); Line(120,220,80,260); Line(120,220,160,260); Line(120,100,120,320);
for i := 1 to 10 do begin x := random (1024); y := random (200);
for j:=1 to 3 do begin x1:=random(800); y1:=random(100); line(x1,y1,x1+40,y1+40); line(x1,y1+20,x1+40,y1+20); line(x1+40,y1,x1,y1+40); Line(x1+20,y1,x1+20,y1+40); end;
int main()
{
// Считываем.
int n;
std::cin >> n;
int * a = new int[n];
int t;
int i = 0;
while (n - i){
if (std::cin >> t){
a[i++] = t;
}
}
// Находим и выводим.
n--;
int max = -1;
for (i = n-1; i >= 0; --i){
if (a[i] > *a && a[i] < a[n]){
max = i;
break;
}
}
std::cout << max+1 << std::endl;
delete [] a;
std::cin.get();
std::cin.get();
return 0;
}