Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int contains_in(float x, float y, float cx, float cy, int radius)
- {
- if(x*x - 2*cx*x + cx*cx + y*y - 2*cy*y + cy*cy <= radius*radius )
- return 1;
- else
- return 0;
- }
- int contains_count(float points[], float cx, float cy, int radius)
- {
- for(int i = 0; i < 10; i += 2)
- {
- if(contains_in(points[i], points[i+1], cx,cy, radius) == 0)
- return 0;
- }
- return 1;
- }
- int main()
- {
- float x = 1;
- float y = 2;
- float cx = 0;
- float cy = 9;
- int R = 5;
- int cifra = contains_in(x, y, cx, cy, R);
- printf("%d\n", cifra);
- float masil[10] = {1,2,2,2,1,3};
- cifra = contains_count(masil, cx, cy, R);
- printf("%d", cifra);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement