|
|
вернуться в форумWhy my program does not work? >Why my program get Compilation error? >var ric,min,max,i,j,k,l,m,n: longint; > a:array [1..1000] of longint; >begin > read (n,k); > min:=1; > for i:=1 to n-1 do > min:=min*10; > max:=k-1; > for i:=1 to n-1 do > max:=max*10+(k-1); > 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. Re: Why my program does not work? > >Why my program get Compilation error? > >var ric,min,max,i,j,k,l,m,n: longint; > > a:array [1..1000] of longint; > >begin > > read (n,k); > > min:=1; > > for i:=1 to n-1 do > > min:=min*10; > > max:=k-1; > > for i:=1 to n-1 do > > max:=max*10+(k-1); > > 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. > 1. warning: missing program header; (program my1009) GPC have not find anu other errors ... 2. You change i into for. That's all. By ... Time Limit Exesteeded. |
|
|