ROTATION - Quay bánh xe

Tác giả: ll931110

Ngôn ngữ: Pascal

Program ROTATION;
        Const
                input  = '';
                output = '';
        Var
                 n,num: integer;

Procedure init;
          Var
                      fi: text;
                 i,a,b,c: integer;
          Begin
                Assign(fi, input);
                        Reset(fi);

                Readln(fi, n);
                num:= 0;

                For i:= 1 to n - 1 do
                        Begin
                                Readln(fi, a, b, c);
                                If c = 1 then inc(num);
                        End;

                Close(fi);
          End;

Procedure solve;
          Var
                fo: text;
          Begin
                Assign(fo, output);
                        Rewrite(fo);

                If odd(num) then writeln(fo, 1) else writeln(fo, 0);
                Close(fo);
          End;

Begin
        init;
        solve;
End.

Download