уменьшить количество строк в коде язык программирования Паскаль оставив принцип роботы уже уменьшил с 486 до 255 либо подскажите как уменьшить количество строк
program krestiki_noliki;
uses
Crt, Graph;
var
g, key, i, s: Integer;
mas: array [1..9] of Integer;
procedure field;
begin
bar(100, 100, 620, 620);
bar(100, 273, 620, 446);
bar(273, 100, 446, 620);
end;
procedure reset;
begin
key := 2;
delay(1000);
cleardevice;
key := 0;
for i := 1 to 9 do
mas[i] := 0;
field
end;
procedure draw;
begin
for i := 1 to 9 do
s := s + mas[i];
if s = 13 then
begin
key := 2;
delay(1000);
reset;
end ;
end;
begin
InitGraph(detect, detect, '');
field;
while true do
begin
while key = 0 do
begin
g := readKey;
if (g = '1') and (mas[1] = 0) then
begin
line(130, 130, 243, 243);
line(243, 130, 130, 243);
key := 1;
mas[1] := 1;
end
else if (g = '2') and (mas[2] = 0) then
begin
line(303, 130, 416, 243);
line(416, 130, 303, 243);
key := 1;
mas[2] := 1;
end
else if (g = '3') and (mas[3] = 0) then
begin
line(476, 130, 590, 243);
line(590, 130, 476, 243);
key := 1;
mas[3] := 1;
end
else if (g = '4') and (mas[4] = 0) then
begin
line(130, 303, 243, 416);
line(243, 303, 130, 416);
key := 1;
mas[4] := 1;
end
else if (g = '5') and (mas[5] = 0) then
begin
line(303, 303, 416, 416);
line(416, 303, 303, 416);
key := 1;
mas[5] := 1;
end
else if (g = '6') and (mas[6] = 0) then
begin
line(476, 303, 590, 416);
line(590, 303, 476, 416);
key := 1;
mas[6] := 1;
end
else if (g = '7') and (mas[7] = 0) then
begin
line(130, 476, 243, 590);
line(243, 476, 130, 590);
key := 1;
mas[7] := 1;
end
else if (g = '8') and (mas[8] = 0) then
begin
line(303, 476, 416, 590);
line(416, 476, 303, 590);
key := 1;
mas[8] := 1;
end
else if (g = '9') and (mas[9] = 0) then
begin
line(476, 476, 590, 590);
line(590, 476, 476, 590);
key := 1;
mas[9] := 1;
end ;
s := 0;
if (mas[1] = 1) and (mas[2] = 1) and (mas[3] = 1) then
begin
line(130, 186, 590, 186);
reset;
end
else if (mas[4] = 1) and (mas[5] = 1) and (mas[6] = 1) then
begin
line(130, 359, 590, 359);
reset;
end
else if (mas[7] = 1) and (mas[8] = 1) and (mas[9] = 1) then
begin
line(130, 532, 590, 532);
reset;
end
else if (mas[1] = 1) and (mas[4] = 1) and (mas[7] = 1) then
begin
line(186, 130, 186, 590);
reset;
end
else if (mas[2] = 1) and (mas[5] = 1) and (mas[8] = 1) then
begin
line(359, 130, 359, 590);
reset;
end
else if (mas[3] = 1) and (mas[6] = 1) and (mas[9] = 1) then
begin
line(532, 130, 532, 590);
reset;
end
else if (mas[1] = 1) and (mas[5] = 1) and (mas[9] = 1) then
begin
line(130, 130, 590, 590);
reset;
end
else if (mas[3] = 1) and (mas[5] = 1) and (mas[7] = 1) then
begin
line(590, 130, 130, 590);
reset;
end ;
draw;
end;
while key = 1 do
begin
g := readkey;
if (g = '1') and (mas[1] = 0) then
begin
arc(186, 186, 0, 360, 56);
key := 0;
mas[1] := 2;
end
else if (g = '2') and (mas[2] = 0) then
begin
arc(359, 186, 0, 360, 56);
key := 0;
mas[2] := 2;
end
else if (g = '3') and (mas[3] = 0) then
begin
arc(532, 186, 0, 360, 56);
key := 0;
mas[3] := 2;
end
else if (g = '4') and (mas[4] = 0) then
begin
arc(186, 359, 0, 360, 56);
key := 0;
mas[4] := 2;
end
else if (g = '5') and (mas[5] = 0) then
begin
arc(359, 359, 0, 360, 56);
key := 0;
mas[5] := 2;
end
else if (g = '6') and (mas[6] = 0) then
begin
arc(532, 359, 0, 360, 56);
key := 0;
mas[6] := 2;
end
else if (g = '7') and (mas[7] = 0) then
begin
arc(186, 532, 0, 360, 56);
key := 0;
mas[7] := 2;
end
else if (g = '8') and (mas[8] = 0) then
begin
arc(359, 532, 0, 360, 56);
key := 0;
mas[8] := 2;
end
else if (g = '9') and (mas[9] = 0) then
begin
arc(532, 532, 0, 360, 56);
key := 0;
mas[9] := 2;
end ;
if (mas[1] = 2) and (mas[2] = 2) and (mas[3] = 2) then
begin
line(130, 186, 590, 186);
reset;
end
else if (mas[4] = 2) and (mas[5] = 2) and (mas[6] = 2) then
begin
line(130, 359, 590, 359);
reset;
end
else if (mas[7] = 2) and (mas[8] = 2) and (mas[9] = 2) then
begin
line(130, 532, 590, 532);
reset;
end
else if (mas[1] = 2) and (mas[4] = 2) and (mas[7] = 2) then
begin
line(186, 130, 186, 590);
reset;
end
else if (mas[2] = 2) and (mas[5] = 2) and (mas[8] = 2) then
begin
line(359, 130, 359, 590);
reset;
end
else if (mas[3] = 2) and (mas[6] = 2) and (mas[9] = 2) then
begin
line(532, 130, 532, 590);
reset;
end
else if (mas[1] = 2) and (mas[5] = 2) and (mas[9] = 2) then
begin
line(130, 130, 590, 590);
reset;
end
else if (mas[7] = 2) and (mas[5] = 2) and (mas[3] = 2) then
begin
line(590, 130, 130, 590);
reset;
end ;
end;
end;
end.
/** libraries */
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
/** libraries */
using namespace std;
/** defines */
#define ll long long
#define ld long double
#define yes cout << "YES" << "\n"
#define no cout << "NO" << "\n"
/** defines */
ld func1(ld x, ld y, ld z){
return 5 * atan(x) - (1/4) * acos(x) * ((x + 3 * abs(x-y) + pow(x,2))/(abs(x-y) * z + pow(x,2)));
}
ld func2(ld x, ld y, ld z){
return (pow(M_E,abs(x-y)) * pow(abs(x-y),x+y))/(atan(x)+atan(z)) + pow(pow(x,6) + pow(log(y),2),(1/3));
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ld x,y,z;
cin >> x >> y >> z;
cout << func1(x,y,z) << "\n" << func2(x,y,z);
}
P.S если я где-то косякнул по невнимательности, то пишите, исправим
var
i:integer;
begin
writeln('1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20');
readln
end.
Вывести квадраты чисел от 1 до 10
var
i: integer;
begin
for i:=1 to 10 do
writeln(i:4,' ',sqr(i):4);
readln
end.
Число n вводят с клавиатуры.Напечатать n раз число 5 (и оставшиеся 2 задачи можно этой же, просто поменяй кое-какие детали, подумай какие)
var
i,n:integer;
begin
writeln('Введите кол-во повторов числа: ');
readln(n);
for i:=1 to n do
writeln('5');
readln
end.