|
|
back to boardThere are two labels in one string! For each string S of input I used the following checking procedure: n:=0; for p1:=1 to length(S) do inc(n,ord(S[p1]=':')); if n>1 then halt(1); But my program is still AC. It means that there is no string with two or more ':' inside. Could you explain what does "two labels in one string" mean? You might give an example of such incorrect string. S = Str, ff = 0; lmn: sscanf(S, "%s", Lab); if (Lab[(len = strlen(Lab)) - 1] == ':') { if (ff) while (1); Low(Lab); Lab[len - 1] = 0; if ((i = GetObj(Lab)) == -1) AddObj(Lab, ComN); else ObjVal[i] = ComN; S += len; ff = 1; goto lmn; } Gets TLE 12, but without "if (ff) while (1);" it gets AC. PS: without "goto lmn;" it gets WA 12. Edited by author 04.06.2006 23:42 Your code reads one label twice! sscanf(S, "%s", Lab) skips spaces in the beginning of line, but S+=len doesn't skip. Thank you :) PS: I repeat this bug again and again :( Test 12: labels after the last command. Like this: a = 1 label: |
|
|