// PascalABC.NET 3.1, сборка 1250 от 28.05.2016 begin var a:=-1.32; var b:=1.49; var h:=0.11; var y1:=-14.0; var y2:=17.0; var k:=0; var x:=a; while x<=b do begin var y:=Tan(x); if (y>=y1) and (y<=y2) then begin Writeln('x=',x:5:2,' y=',y:7:4); Inc(k) end; x+=h end; Writeln('Найдено значений: ',k) end.
int main() { int n; scanf("%d", &n); bool a[n][n]; memset(a, true, sizeof(a)); int m; scanf("%d", &m); for (int k = 0; k < m; ++k) { int x, y, aa; scanf("%d%d%d", &x, &y, &aa); for (int i = x; i < min(x + aa, n + 1); ++i) { for (int j = y; j < min(y + aa, n + 1); ++j) { a[i][j] = false; } } } int cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (a[i][j]) { cnt++; } } } printf("%d", cnt); return 0; }
begin
var a:=-1.32;
var b:=1.49;
var h:=0.11;
var y1:=-14.0;
var y2:=17.0;
var k:=0;
var x:=a;
while x<=b do begin
var y:=Tan(x);
if (y>=y1) and (y<=y2) then begin
Writeln('x=',x:5:2,' y=',y:7:4);
Inc(k)
end;
x+=h
end;
Writeln('Найдено значений: ',k)
end.
Результат
x=-1.32 y=-3.9033
x=-1.21 y=-2.6503
x=-1.10 y=-1.9648
x=-0.99 y=-1.5237
x=-0.88 y=-1.2097
x=-0.77 y=-0.9697
x=-0.66 y=-0.7761
x=-0.55 y=-0.6131
x=-0.44 y=-0.4708
x=-0.33 y=-0.3425
x=-0.22 y=-0.2236
x=-0.11 y=-0.1104
x= 0.00 y= 0.0000
x= 0.11 y= 0.1104
x= 0.22 y= 0.2236
x= 0.33 y= 0.3425
x= 0.44 y= 0.4708
x= 0.55 y= 0.6131
x= 0.66 y= 0.7761
x= 0.77 y= 0.9697
x= 0.88 y= 1.2097
x= 0.99 y= 1.5237
x= 1.10 y= 1.9648
x= 1.21 y= 2.6503
x= 1.32 y= 3.9033
x= 1.43 y= 7.0555
Найдено значений: 26
#include <string.h>
#include <algorithm>
using namespace std;
int main() {
int n;
scanf("%d", &n);
bool a[n][n];
memset(a, true, sizeof(a));
int m;
scanf("%d", &m);
for (int k = 0; k < m; ++k) {
int x, y, aa;
scanf("%d%d%d", &x, &y, &aa);
for (int i = x; i < min(x + aa, n + 1); ++i) {
for (int j = y; j < min(y + aa, n + 1); ++j) {
a[i][j] = false;
}
}
}
int cnt = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j]) {
cnt++;
}
}
}
printf("%d", cnt);
return 0;
}