- 笨小猴
- 2012-11-01 20:20:51 @
foo.pas(11,13) Warning: Variable "a" does not seem to be initialized
├ 测试数据 01:答案正确... (0ms, 580KB)
├ 测试数据 02:答案正确... (0ms, 580KB)
├ 测试数据 03:答案正确... (0ms, 580KB)
├ 测试数据 04:答案正确... (0ms, 580KB)
├ 测试数据 05:答案正确... (0ms, 580KB)
├ 测试数据 06:答案正确... (0ms, 580KB)
├ 测试数据 07:答案正确... (0ms, 580KB)
├ 测试数据 08:答案正确... (0ms, 580KB)
├ 测试数据 09:答案错误... (0ms, 580KB)
├ 测试数据 10:答案错误... (0ms, 580KB)
---|---|---|---|---|---|---|---|-
Unaccepted / 80 / 0ms / 580KB
view sourceprint?01 var
02 b:string;
03 i,s,max,min,l:integer;
04 flag:boolean;
05 j:char;
06 a:array['a'..'z'] of integer;
07 begin
08 readln(b);
09 l:=length(b);
10 for i:=1 to l do
11 inc(a[b[i]]);
12 max:=0;min:=10000;
13 for j:='a' to 'z' do
14 if a[j]0 then
15 begin
16 if a[j]>max then max:=a[j];
17 if a[j]
1 条评论
-
821042639 LV 6 @ 2013-03-13 17:32:59
21行是 for i:= 2 to s-1 do 吧
另附我的代码
var a:string;j:char;
i,m,n,q:longint;c:boolean;
b:array['a'..'z'] of longint;begin
c:=true;
readln(a);m:=0;n:=maxlongint;
for i:=1 to length(a) do
b[a[i]]:=b[a[i]]+1;
for j:='a' to 'z' do
begin
if (b[j]<>0) and (b[j]>m) then m:=b[j];
if (b[j]<>0) and (b[j]<n) then n:=b[j];
end;
q:=m-n;
for i:=2 to q-1 do
if q mod i = 0 then c:=false;
if (q=0) or (q=1) then c:=false;
if c=true then
begin
writeln('Lucky Word');
writeln(q);
end
else
begin
writeln('No Answer');
writeln('0');
end;
end.
- 1