|
|
вернуться в форумWhy WA?! Послано Drizzt 19 июл 2003 15:05 Could anyone tell me why I always got WA? Thank you. Here is my program : program N2 (input, output); var lX, lY, lK : longint; x, y : array [1.. 1000] of longint; function solve (lT : longint) : boolean; var lX1, lY1, lU, lV, lMax : longint; begin lU := 1000; lV := 1000; lX1 := lX; lY1 := lY; repeat x [lU] := lX1 mod lT; lX1 := lX1 div lT; lU := lU - 1; until lX1 = 0; repeat y [lV] := lY1 mod lT; lY1 := lY1 div lT; lV := lV - 1; until lY1 = 0; lU := lU + 1; lV := lV + 1; lMax := 1001 - lV; for lX1 := lU to 1000 do if y [lV] = x [lX1] then begin lMax := lMax - 1; lV := lV + 1; end; if lMax = 0 then solve := true else solve := false; end; begin readln (lX, lY); lK := 2; repeat if solve (lK) = true then begin writeln (lK); halt; end; lK := lK + 1; until lK > lX; writeln ('No solution'); end. |
|
|