|
|
вернуться в форумWHI I GOT Time Limit Exceeded. HERE IS A MY PRIGRAM. THENKS var sol,gam,i,j,k,m,n:longint; min,min1:real; procedure readdata; begin readln (n,m); end; procedure solve; begin min:=n; if n=1 then begin writeln (1); halt; end; min1:=m; for i:=n to m do begin k:=i div 2; for j:=2 to k do if i mod j = 0 then gam:=gam+j; min:=gam/i; if min1>min then begin sol:=i; min1:=min; end; gam:=1; end; end; procedure print; begin writeln (sol); end; begin readdata; solve; print; end. Re: WHI I GOT Time Limit Exceeded. HERE IS A MY PRIGRAM. THENKS try this test 1 1000000 => time limit of course O( n * (n + 1) / 4 ) => too big. Thinhk more little , you will find something interesting. Good luck |
|
|