|
|
вернуться в форумОбщий форумWHY WRONG ANSWER 1084 {DO you know how to make that type real was 1234.12312 but not 1.23e+1& How to make a round to third element after"."} program acm; var a,b,r,s,sn,cs:real;x,y:integer; st,st1,st2:string; begin readln(a,r); if (a<=100) and (r<=100) then begin if r<=(a/2) then begin s:=(pi)*r*r; end; if r>=(a/(sqrt(2))) then begin s:=a*a; end; if (r>(a/2)) and (r<(a/(sqrt(2)))) then begin sn:=sqrt(1-(a*a)/(4*r*r)); cs:=sqrt(1-sn*sn); b:=arctan(sn/cs); s:=(pi)*r*r-2*2*b*r*r+2*a*r*sn; end; x:=trunc(s); if trunc(frac(s)*10)=0 then begin y:=trunc(frac(s)*1000); str(x,st); str(y,st1); st2:=(st+'.'+'0'+st1); end; if trunc(frac(s)*100)=0 then begin y:=trunc(frac(s)*1000); str(x,st); str(y,st1); st2:=(st+'.'+'00'+st1); end; if trunc(frac(s)*1000)=0 then begin y:=trunc(frac(s)); str(x,st); str(y,st1); st2:=(st+'.'+'000'); end; if trunc(frac(s)*10)<>0 then begin y:=trunc(frac(s)*1000); str(x,st); str(y,st1); st2:=(st+'.'+st1); end; writeln(st2); end; readln; end. Re: DO you know how to make that type real was 1234.12312 but not writeln(R:0:3) |
|
|