http://codeforces.com/contest/236/problem/C
觉得这题挺有意思,贴一下代码。if(a<=0)or(b<=0)or(c<=0)then continue;这句一开始没写,WA了。注意多个数的LCM求法。
Codeprogram LCMchallenge; uses math; var i,j,k:longint; n,a,b,c,ans,temp:int64; function GCD(a,b:int64):int64; var r:int64; begin while a mod b<>0 do begin r:=a mod b; a:=b;b:=r; end; GCD:=b; end; function LCM(a,b:int64):int64; begin LCM:=a div GCD(a,b) *b;end; begin readln(n);ans:=0; case n of 1:ans:=1; 2:ans:=2; 3:ans:=6; else begin if(n and 1)=1 then ans:=n*(n-1)*(n-2) else begin for i:=0 to 50 do for j:=i+1 to 50 do for k:=j+1 to 50 do begin a:=n-i;b:=n-j;c:=n-k; if(a<=0)or(b<=0)or(c<=0)then continue; ans:=max(ans,LCM(LCM(a,b),c)); end; end; end; end; writeln(ans); readln; end.