diff options
Diffstat (limited to 'others/volume1/029.pas')
-rw-r--r-- | others/volume1/029.pas | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/others/volume1/029.pas b/others/volume1/029.pas new file mode 100644 index 0000000..255331f --- /dev/null +++ b/others/volume1/029.pas @@ -0,0 +1,23 @@ +uses sortnfind; + +var + n, i: int16; + p: int64; + a, b: array of int64; + +begin + readln(n, p); + setlength(a, n); + setlength(b, n); + for i := 0 to n - 1 do + begin + read(a[i]); + b[i] := a[i] + end; + qsort(a); + p := a[p - 1]; + for i := 0 to n - 1 do + if b[i] = p then + break; + writeln(p, ' ', i + 1) +end. |