Thứ Năm, 19 tháng 5, 2022

boiso pascal



const fi='boiso.inp';      fo='boiso.out';
var S:string;
    c,i,x:longint;
    ok:array[0..999]of byte;

function check(c1,c2,c3:char):byte; //kt dieu kien
var a,b,c:byte;
begin
        if c1='0' then exit(0); 
        a:=ord(c1)-48;
        b:=ord(c2)-48;
        c:=ord(c3)-48;
        if a+c=b then exit(1)
        else exit(0);
end;

procedure solve;
var res,i:longint;
begin
        readln(s);
        res:=0;
        for i:=1 to length(S)-2 do
        begin
                res:=res+check(s[i],s[i+1],s[i+2]);
        end;
writeln(res);
end;

begin
assign(input,fi);reset(input);
assign(output,fo);rewrite(output);
solve;
close(input);close(output);
end.

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.