怎樣用遞迴找出一組數中的最大數

2022-07-02 13:50:04 字數 738 閱讀 2704

1樓:夢歸霧散

遞迴?無語了……

var a:array[1..100] of integer;

function max:integer;

function max2(x,y:integer);beginif xr then sub:=32767else if l=r then sub:

=a[l]else sub:=max2(sub(l,l+r div 2),sub((l+r) div 2+1,r);

end;

begin

max:=sub(1,100);

end;

begin

......

writeln(max);

end.

居然有這種要求……

2樓:

program zz;

var a:array[1..1000] of integer;

i,n,max:integer;

procedure px(i:integer);

begin

if a[max]n then px(i+1);

end;

begin

readln(n);

for i:=1 to n do

read(a[i]);

max:=1;

px(1);

writeln(a[max]);

end.

VB中怎樣統計一組數中每個數字出現的個數

private sub command3 click dim a 1 to 100 b 0 to 9 for i 1 to 100 a i int rnd 100 1 print a i if i mod 10 0 then print end if 上面是隨機產生100個整數 for i i to...

怎樣用任意數計算得,怎樣用任意乙個數 計算得

大哥我建議你不要這麼幼稚 直接表白比較好 你心裡隨便想乙個數字,然後加上52.8再乘5,然後再減去3.9343,再除0.5後減去你心中想的那位數的十倍等於520.1314 其它很簡單,換算一下,最後結果永遠是 260.0657除以0.5 既為 520.1314 中學水平,它是先設定乙個數 520.1...

請問下大家知道excel中如何統計一組資料裡大於等於 30小於等於30了解的告訴下喲,真心謝謝大家了喳

例如,假定統計區域是a b countif a b,30 countif a b,30 countif 範圍,條件 看一下excel自帶的教程 看一下excel的教程 麻煩大家看一下excel中如何統計一組資料裡大於等於 30小於等於30.有曉得的人就說下哈,非常謝謝大家4j 用sumif a1 c...