O(n)先判断a[i]数组的正负,输出符号,再输出系数和‘x',最后输出幂次方。var i,n,k:integer; flag:boolean;begin readln(n); flag:=true; for i:=n downto 1 do begin read(k); if k=0 then continue; if (not flag)and(k>0) then write('+'); if k<0 then write('-'); if abs(k)=1 then write('x'); if abs(k)>1 then write(abs(k),'x'); if (i<>1)and(i<>0) then write('^',i); flag:=false; end; read(k); if k>0 then begin if k<>0 then write('+');write(k);flag:=false;end else begin if k<0 then write(k);flag:=false;end; if flag then writeln('0');end.