Re: I got AC! Place your achievements here!
How do you get 0.001 sec?
I'm quite sure there's nothing to improve in my code.
I get 0.015 sec using FreePascal.
Where do I go wrong??
Как Вы достигаете 0.001 секунды? Я не вижу где можно улучшить код для FreePascal.
Есть идеи?
var
c: array[32..122] of byte;
n, i, sum: integer;
s: string;
begin
c[32] := 1;
c[33] := 3;
c[44] := 2;
c[46] := 1;
c[121] := 1;
c[122] := 2;
for i := 97 to 120 do
c[i] := (i - 97) mod 3 + 1;
readln(s);
n := length(s);
sum := 0;
for i := 1 to n do
sum := sum + c[byte(s[i])];
writeln(sum);
end.