program Toddu; uses crt; const kart: array[6..14] of string[2] = ('6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'); var f1, f2: text; i, j: byte; s: string; r1, r2: string[2]; m1, m2: string[1]; koz: string[1]; res: boolean; begin clrscr; assign(f1, 'cards.dat'); assign(f2, 'cards.res'); reset(f1); readln(f1, koz); readln(f1, r1); readln(f1, m1); readln(f1, r2); readln(f1, m2); for i := 6 to 14 do if kart[i] = r1 then break; for j := 1 to 14 do if kart[j] = r2 then break; if (m1 = koz) and (m2 <> koz) then res := true; if (m2 = m1) then if i > j then res := true; ReWrite(f2); If (res) then Writeln(f2, 'YES') else Writeln(f2,'NO'); Close(f1); Close(f2); end.
Источник: |