切换到宽版
  • 7324阅读
  • 1回复

新手的菜鸟问题 [复制链接]

上一主题 下一主题
离线victorlee129
 
只看楼主 倒序阅读 0 发表于: 2006-11-13
那道Greedy Gift Givers是啥意思?(没有翻译!)
[ 此贴被victorlee129在2006-11-14 21:08重新编辑 ]
离线victorlee129
只看该作者 1 发表于: 2006-11-16
— (swj05652) 与版规不符:请勿帖源代码,谢谢配合 (2006-11-17 18:42) —
codd:
{
ID:victorl1
PROG:gift1
LANG:PASCAL
}
var
a:array[1..10,1..10]of integer;
b:array[1..10]of string;
i,j,n,m,k,t:integer;
s:string;
function sum(i:integer):integer;
begin
sum:=0;
for j:=1 to n do inc(sum,a[i,j]);
end;
function chose(s:string):integer;
var
i:integer;
begin
for i:=1 to n do if b=s then begin chose:=i;exit;end;
end;
begin
assign(input,'gift1.in');reset(input);
assign(output,'gift1.out');rewrite(output);
readln(n);
for i:=1 to n do readln(b);
for i:=1 to n do
begin
readln(s);
readln(m,k);
t:=chose(s);
a[t,t]:=-m;
for j:=1 to k do
begin
  readln(s);
  a[chose(s),t]:=m div k;
end;
end;
for i:=1 to n do writeln(b,' ',sum(i));
close(input);
close(output);
end.
[p:2]
快速回复
限100 字节
 
上一个 下一个