|
|
back to boardwhi my program get CE? ENIBODY CAN HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE var ric,min,max,i,j,k,l,m,n: longint; a:array [1..1000] of longint; begin readln (n,k); min:=1; i:=1; while i=n-1 do begin min:=min*10; inc (i); end; max:=k-1; j:=1; while j=n-1 do begin max:=max*10+(k-1); inc (j); end; for i:=min to max do begin ric:=i; l:=0; while ric<>0 do begin inc (l); a[l]:=(ric mod 10); ric:=(ric div 10); end; for j:=1 to l do if a[j]>k-1 then begin a[j]:=0; inc (a[j+1]); end; i:=0; for j:=l downto 1 do i:=i*10+a[j]; if (i mod 100)<>0 then inc(m); end; writeln (m); end. You have to learn a little Delphi, have a look at my comment :) > var ric,min,max,i,j,k,l,m,n: longint; > a:array [1..1000] of longint; > begin > readln (n,k); > min:=1; > i:=1; > while i=n-1 do > begin > min:=min*10; > inc (i); > end; > max:=k-1; > j:=1; > while j=n-1 do > begin > max:=max*10+(k-1); > inc (j); > end; > for i:=min to max do > begin > ric:=i; > l:=0; > while ric<>0 do > begin > inc (l); > a[l]:=(ric mod 10); > ric:=(ric div 10); > end; > for j:=1 to l do > if a[j]>k-1 then > begin > a[j]:=0; > inc (a[j+1]); > end; > i:=0; {HAve a look at my comment - here is your wrong!!!} > for j:=l downto 1 do > i:=i*10+a[j]; > if (i mod 100)<>0 then > inc(m); > end; > writeln (m); > end. > Hei, the compiler in timus is Delphi - you can not change the value of a variable, that controls the cicle, but in PAscal that i spossible Where you have written "i=0", use another variable..I think, you will get accepted. Bye! from Vlado |
|
|