int a,n[11],i,c,x=0 for(i=1i<=10i++)
{cin>>n[i]
}
cin>>c
c=c+30 for(i=1i<旅滑=10i++)
{if(n[i]<=c)
x++
}
cout<<x return 0
}
淘淘尺镇型摘苹果
把输出j:=0
for k:=1 to m do
for i:=1 to m do
begin
if num[i]=p+1
then begin
if bool=false
then begin
write(' ',much[i])
p:=p+1
end
if bool
then begin
write(much[i])
p:=p+1
bool:=false
end
end
end
writeln
这一块芦春改成
write(much[num[1]])
for i:=2 to m do write(' ',much[num[i]])
writeln
就可以了。
下面扰坦是我写的程序
type
arr=array[1..100000]of longint
var
n,m,i,ap,j,k,p:longint
apple,num,weight,ans:arr
bool:boolean
procedure qsort(n,m:longint)
var
a,b,c,temp:longint
begin
a:=nb:=mc:=apple[(n+m)div 2]
repeat
while c>apple[a] do inc(a)
while c<apple[b] do dec(b)
if a<陪李耐=b
then begin
temp:=apple[a]apple[a]:=apple[b]apple[b]:=temp
inc(a)dec(b)
end
until a>b
if a<m then qsort(a,m)
if b>n then qsort(n,b)
end
procedure wqsort(n,m:longint)
var
a,b,c,temp:longint
begin
a:=nb:=mc:=weight[(n+m)div 2]
repeat
while c <apple[a] do inc(a)
while c >apple[b] do dec(b)
if a<=b
then begin
temp:=weight[a]weight[a]:=weight[b]weight[b]:=temp
temp:=num[a]num[a]:=num[b]num[b]:=temp
inc(a)dec(b)
end
until a>b
if a<m then wqsort(a,m)
if b>n then wqsort(n,b)
end
begin
readln(n,m)
for i:=1 to n do read(apple[i])
for i:=1 to m do
begin
read(weight[i])
num[i]:=i
end
qsort(1,n)wqsort(1,m)
i:=1j:=n
while(j>0)do
begin
ans[i]:=ans[i]+apple[j]
dec(j)i:=i mod m+1
end
write(ans[num[1]])
for i:=2 to m do write(' ',ans[num[i]])
end.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)