为什么错

P1618 三连击(升级版)

dingxiheng @ 2016-07-12 17:03:03

var i,j,k,a,b,c,t,d:longint;
function pd(a,b,c:longint):boolean;
var s1,s2,s3,s:string;
i:longint;
 ch:char;
g:array['0'..'9'] of 0..9;
begin
   str(a,s1);
   str(b,s2);
   str(c,s3);
   s:=s1+s2+s3;
   for ch:='0' to '9' do
      g[ch]:=0;
   for i:=1 to length(s) do
   inc(g[s[i]]);
   for ch:='1' to '9'  do
     if g[ch]<>1 then exit(false);
   exit(true);
end;
begin
   readln(a,b,c);
   for i:=1 to a do
     if (a mod i=0)and(b mod i=0)and(c mod i=0) then d:=i;
     a:=a div d;
     b:=b div d;
     c:=c div d;
   for i:=1 to  999 div c do
   begin
      j:=trunc(i*b/a);
      k:=trunc(i*c/a);
      if pd(i,j,k) then  begin writeln(i,' ',j,' ',k); inc(t);END;
   end;
   if t=0 then writeln('No!!!')
end.

|