- 贪婪的送礼者
- 2014-05-10 18:48:41 @
pascal:
var
np,r :byte;
name1,name2:string;
name :array[1..10] of string;
m :array[1..10] of longint;
i,j,k,q :longint;
begin
readln(np);
for i:=1 to np do
readln(name[i]);
for i:=1 to np do
begin
readln(name1);
readln(q,r);
if r<>0 then
begin
for j:=1 to np do
if name[j]=name1 then m[j]:=m[j]+(q mod r)-q;
q:=q-(q mod r);
for j:=1 to r do
begin
readln(name2);
for k:=1 to np do
if name[k]=name2 then m[k]:=m[k]+q div r;
end;
end;
end;
for i:=1 to np do
writeln(name[i],' ',m[i]);
end.
3 条评论
-
浪影随行 LV 4 @ 2016-03-25 19:48:26
666赞一个
-
2014-07-17 18:12:58@
我也AC
-
2014-05-10 19:41:03@
请发到题解区
- 1