• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Feb 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <stdio.h>
2.
3. int main()
4. {
5.     long int n,i,j,q,sum=0,l,x1,y1;
6.     scanf("%ld",&n);
7.     double X[n],Y[n],M[n],N[n],k[n],V[n];
8.     for(i=0; i<n; ++i)
9.     {
10.          scanf("%lf%lf%lf%lf",&X[i],&Y[i],&M[i],&N[i]);
11.          if (Y[i]!=N[i] && X[i]!=M[i])
12.          {
13.           k[i]=(N[i]-Y[i])/(M[i]-X[i]);
14.           V[i]=(N[i]*X[i]-Y[i]*M[i])/(X[i]-M[i]);
15.          }
16.     }
17.     scanf("%ld",&q);
18.     double A[q],B[q],R[q],Q[q];
19.     for(i=0; i<q; ++i)
20.     {
21.          scanf("%lf%lf%lf",&A[i],&B[i],&R[i]);
22.     }
23.     for (i=0; i<q; ++i)
24.     {
25.          for (j=0; j<n; ++j)
26.          {
27.            if (X[j]==M[j] && X[j]<R[i]+A[i] && X[j]>A[i]-R[i])
28.            {
29.              sum++;
30.            }
31.            else if (Y[j]==N[j] && Y[j]<R[i]+B[i] && Y[j]>B[i]-R[i])
32.            {
33.              sum++;
34.            }
35.            else if (X[j]!=M[j] && Y[j]!=N[j])
36.            {
37.                 if (R[i]*R[i]*(k[j]*k[j]+1)-(k[j]*A[i]-B[i]+V[j])*(k[j]*A[i]-B[i]+V[j])>=0) // formula za proveru pripadnosti prave kruznici
38.                 {
39.                      sum++;
40.                 }
41.            }
42.          }
43.          printf("%ld\n",sum);
44.          sum=0;
45.     }
46.     return 0;
47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top