weight-build.pas 625 B

1234567891011121314151617181920212223242526272829303132333435
  1. program hxy;
  2. Const maxn=1000;
  3. Var a,need:array[1..maxn]of longint;
  4. n,m,s,i:longint;
  5. begin
  6. randomize;
  7. assign(output,'weight.in');
  8. rewrite(output);
  9. n:=1000; m:=1000;
  10. for i:=1 to m do need[i]:=random(1000)+1;
  11. for i:=1 to n do a[i]:=need[random(m)+1];
  12. writeln(n,' ',m);
  13. for i:=1 to m-1 do write(need[i],' ');
  14. writeln(need[m]);
  15. s:=0;
  16. for i:=1 to n do
  17. begin
  18. inc(s,a[i]);
  19. write(s,' ');
  20. end;
  21. s:=a[n];
  22. write(s);
  23. for i:=n-1 downto 1 do
  24. begin
  25. inc(s,a[i]);
  26. write(' ',s);
  27. end;
  28. writeln;
  29. {writeln;
  30. writeln;
  31. for i:=1 to n do write(a[i],' ');
  32. writeln;}
  33. close(output);
  34. end.