Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- int n,i,j,total=0,difx,dify,sumr;
- int *x,*y,*r;
- scanf("%d",&n);
- x=(int *)malloc(sizeof(int)*n);
- y=(int *)malloc(sizeof(int)*n);
- r=(int *)malloc(sizeof(int)*n);
- for(i=0; i<n; i++) scanf("%d %d %d",&x[i],&y[i],&r[i]);
- for(i=0; i<n; i++)
- {
- for(j=i+1; j<n; j++)
- {
- difx=x[i]-x[j];
- dify=y[i]-y[j];
- sumr=r[i]+r[j];
- if(pow(sumr,2)>pow(difx,2)+pow(dify,2)) total++;
- }
- }
- printf("%d",total);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement