Var i, j, k : integer; a : array [0..9,0..9] of char; procedure U(i,j:integer); var c : char; begin c:=a[i,j]; a[i,j]:=' '; if (c='W')and(a[i+1,j]='B') then U(i+1,j); if (c='B')and(a[i+1,j]='W') then U(i+1,j); if (c='W')and(a[i-1,j]='B') then U(i-1,j); if (c='B')and(a[i-1,j]='W') then U(i-1,j); if (c='W')and(a[i,j+1]='B') then U(i,j+1); if (c='B')and(a[i,j+1]='W') then U(i,j+1); if (c='W')and(a[i,j-1]='B') then U(i,j-1); if (c='B')and(a[i,j-1]='W') then U(i,j-1); end; begin assign(input,'input.txt'); reset(input); assign(output,'output.txt'); rewrite(output); for i:=1 to 8 do begin for j:=1 to 8 do read(a[i,j]); readln end; for i:=1 to 8 do begin a[0,i]:=' '; a[9,i]:=' '; a[i,0]:=' '; a[i,9]:=' ' end; k:=0; for i:=1 to 8 do for j:=1 to 8 do if a[i,j]<>' ' then begin k:=k+1; U(i,j) end; write(k); close(output) end.
Рассмотрим уравнение вида ax³ + bx = 0 Его также можно представить в виде x(ax² + b) = 0 Это же равносильно системе [ x = 0 [ x = ±√( -b / a ) Понятно, что решением этого уравнения, независимо от коэффициентов, будет всегда являться 0. Также уравнение будет иметь и другие корни, при a ≠ 0 и -b / a > 0, это x = ±√( -b / a )
Решение на С #include <stdio.h> #include <math.h> int main() { // Ввод данных float a, b; printf("a = "); scanf("%f", &a); printf("b = "); scanf("%f", &b); // Первый корень уравнения printf("x1 = 0\n"); // Второй и третий корни уравнения if (a != 0 && -b / a > 0) { printf("x2 = %.3f \n", -sqrt(-b / a)); printf("x3 = %.3f \n", sqrt(-b / a)); } return 0; }