题意
把分数从大到小排序,同分数的,学号小的排前。
找出分数大于等于,第m*1.5(向下取整)名的分数,的人。
分析
开始先排序,再一个一个找
var
n,m,i,j,tj:longint;
k,s:array[0..10000]of longint;
t:real;
begin
readln(n,m);
for i:=1 to n do
readln(k[i],s[i]);
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if s[i]<s[j] then
begin
s[0]:=s[i];s[i]:=s[j];s[j]:=s[0];
k[0]:=k[i];k[i]:=k[j];k[j]:=k[0];
end;
if (s[i]=s[j])and(k[i]>k[j]) then
begin
k[0]:=k[i];k[i]:=k[j];k[j]:=k[0];
end;
end;
end;
t:=s[trunc(m*1.5)];
tj:=0;
for i:=1 to n do
if s[i]>=t then inc(tj);
writeln(s[tj],' ',tj);
for i:=1 to tj do
writeln(k[i],' ',s[i]);
close(input);
close(output);
end.