| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
spj在这里,数据没意义,它只用到你的输出,算出来和输入比较一下In Reply To:把Special Judge的代码或者数据给我们看看吧,死的冤阿5555555555555555 Posted by:fcrosfly at 2004-10-10 23:14:10 > rt
{$q+,r+}
program checke;
uses
testlib, sysutils;
const
allowed = ['0'..'9', 'a'..'z', 'A'..'Z', '.', ' '];
max_l = 1000;
eps = 0.005001;
var
ch: char;
c: array [char] of longint;
pe, je: extended;
n: longint;
begin
n := 0;
fillchar(c, sizeof(c), 0);
while not ouf.eof() do begin
ch := ouf.nextChar();
if not (ch in allowed) then begin
if ch in [#10, #13] then break;
if ch < ' ' then begin
halt(1);{quit(_PE, format('Invalid character: #%d', [ord(ch)]));}
end else begin
halt(1);{quit(_PE, format('Invalid character: "%s"', [ch]));}
end;
end;
inc(c[ch]);
inc(n);
if n > max_l then begin
halt(1);{quit(_WA, 'Output too long');}
end;
end;
pe := 0;
for ch := low(c) to high(c) do begin
if c[ch] <> 0 then begin
pe := pe - (c[ch] / n) * ln(c[ch] / n);
end;
end;
pe := pe / ln(2);
je := inf.readReal();
if abs(pe - je) > eps then begin
halt(1);{quit(_WA, format('E=%0.4f instead of %0.2f', [pe, je]));}
end;
halt(0);{quit(_OK, format('dE=%0.4f', [abs(je - pe)]));}
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator