diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-13 10:29:05 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-13 10:29:05 +0700 |
commit | ac0a1ea7dabaee1b986927efb25e94a3a091fff5 (patch) | |
tree | 5765f412d59d73303c2ec981da4c4e1ef073bb99 /others/volume1/044.pas | |
parent | 36461ea5c65fcdf7169abdb39549ef53a15d4f03 (diff) | |
download | cp-ac0a1ea7dabaee1b986927efb25e94a3a091fff5.tar.gz |
Update others/volume1
Diffstat (limited to 'others/volume1/044.pas')
-rw-r--r-- | others/volume1/044.pas | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/others/volume1/044.pas b/others/volume1/044.pas new file mode 100644 index 0000000..1ac29fe --- /dev/null +++ b/others/volume1/044.pas @@ -0,0 +1,34 @@ +var + n, n0, m, m0, i: int16; + a: array of int16; + b: array of boolean; + +begin + readln(n, m); + n0 := n; + setlength(a, n); + setlength(b, n); + for i := 0 to n - 1 do + b[i] := true; + i := -1; + while n0 > 0 do + begin + m0 := m; + while m0 > 0 do + begin + repeat + if i < n - 1 then + inc(i) + else + i := 0 + until b[i]; + dec(m0) + end; + b[i] := false; + a[n - n0] := i + 1; + dec(n0) + end; + for i in a do + write(i, ' '); + writeln +end. |