历届真题 pascal noip
cover:array[0..22000]of boolean; begin read (a[5],a[4],a[3],a[2],a[1],a[0]); if ((a[5]=0) and (a[3]=0) and (a[1]=0)) then begin a[5]:=a[4];a[4]:=a[2]; a[3]:=a[0]; a[2]:=0 a[0]:=0; end: for i:=0 to 5 do if (a[i]>10) then a[i]:=10+(a[i] mod 2); sum:=0: for i:=0 to 5 do sum:=sum+a[i]*(6-i); if ((sum mod 2) <>0) then begin writeln(`Can``t be divided.`); Exit; End; sum:=sum div 2; max:=0; cover[0]:=True; for i:=1 to sum*2 do cover[i]:=False; for i:=0 to 5 do begin j:=0; while (j<a[i])do begin for k:=max downto 0 do begin if (cover[k]) then cover[k+6-i]:=True;end; max:=max+6-i: j:=j+1; end; end; if (cover[sum]) then writeln (`Can be divided.`) else writeln(`can``t be divided.`); end.
输入:4 7 9 20 56 48 输入:1000 7 101 20 55 1 输入:2000 5 l 1 0 0
输出: 输出: 输出:
四、完善程序(第l空2分,其余每空3分共28分)
1.一元二次方程
题目描述:
方程ax^2+bx+c=0,要求给出它的实数解.
输 入:
三个实数:a,b,c,是方程的三个系数(a≠0).