|
|
back to boardRe: WA 3 Not all friends should get money from DAN Re: WA 3 Posted by andy 15 Oct 2011 17:19 and...??? Re: WA 3 And you should give them their money not thinking of ALL the liters someone brought, but of the liters he paid, but didn't drink. E.G. var k, i, s, n: longint; a: array[1..100] of longint; begin readln(n); for i :=1 to n do begin read(a[i]); s := s + a[i]; end; for i := 1 to n do begin write((a[i]*100) div s, ' '); end; end. - WA3 var k, i, s, n: longint; a: array[1..100] of longint; begin readln(n); for i :=1 to n do begin read(a[i]); s := s + a[i]; end; s := s div (n + 1); for i := 1 to n do a[i] := a[i] - s; s := 0; for i := 1 to n do if a[i] > 0 then s := s + a[i]; for i := 1 to n do begin if (a[i] > 0) then write((a[i]*100) div s, ' ') else write('0 '); end; end. - WA6. And then I came to WA 9) I've done some more mistakes, for example i must calculate real numbers, but i did everything with integer, but it is discussed in sime other topics Edited by author 15.10.2011 18:37 |
|
|