记录编号 |
49440 |
评测结果 |
AAAAA |
题目名称 |
小树 |
最终得分 |
100 |
用户昵称 |
o_o |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.125 s |
提交时间 |
2012-11-08 07:42:52 |
内存使用 |
3.99 MiB |
显示代码纯文本
- var
- a,b,c,d,e,f,i,j,m,n,t,x,y,z:longint;
- o:real;
- k:array[0..1000,0..1000]of longint;
- procedure dfs(q,e,s:longint);
- var
- w:longint;
- begin
- for w:=1 to n do
- if (w<>q)and(k[q,w]<>0) then
- begin
- if o<(e+k[q,w])/(s+1) then
- o:=(e+k[q,w])/(s+1);
- dfs(w,e+k[q,w],s+1);
- end;
- end;
- begin
- assign(input,'treec.in');
- assign(output,'treec.out');
- reset(input);
- rewrite(output);
- readln(t);
- for a:=1 to t do
- begin
- o:=0;
- fillchar(k,sizeof(k),0);
- readln(n);
- for b:=1 to n-1 do
- begin
- readln(x,y,z);
- k[x,y]:=z;
- end;
- dfs(0,0,0);
- writeln(o:0:2);
- end;
- close(input);
- close(output);
- end.