- 贪婪的送礼者
- 2014-08-11 20:28:16 @
var
np,i,j,k,money,p,x,l:longint;
m:array[1..15] of longint;
name:array[1..15] of string;
name1,namex:string;
begin
readln(np);
for i:=1 to np do readln(name[i]);
for i:=1 to np do
begin
readln(name1);
for j:=1 to np do
if name[j]=name1 then
begin
readln(money,p);
if p=0 then m[j]:=m[j]+money else begin
x:=money mod p;
money:=money div p;
m[j]:=x+m[j]-money*p;
for k:=1 to p do
begin
readln(namex);
for l:=1 to np do if name[l]=namex then m[l]:=m[l]+money;
end;
end;
end;
end;
for i:=1 to np do writeln(name[i],' ',m[i]);
end.
4 条评论
-
试图遗忘 LV 8 @ 2014-08-15 09:28:25
。。。
-
2014-08-11 20:31:35@
var
money,a:array[1..100] of longint;
name:array[1..100] of string[15];
s:string;
i,j,k,l,n,m,f:longint;
begin
readln(n);
for i:=1 to n do
readln(name[i]);
for i:=1 to n do
begin
readln(s);
for j:=1 to n do
if name[j]=s then k:=j;
j:=k; k:=0;
readln(m,f);
if f<>0 then
begin
money[j]:=(m div f)*f;
m:=m div f;
for j:=1 to f do
begin
readln(s);
for k:=1 to n do
if name[k]=s then inc(a[k],m);
end;
end;
end;
for i:=1 to n do
writeln(name[i],' ',a[i]-money[i]);
end. -
2014-08-11 20:29:14@
人品
-
2014-08-11 20:29:07@
。。。
- 1