Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream cin("bomber.in");
- ofstream cout("bomber.out");
- int n , I;
- struct bomba{
- int x, y, p;
- bool explodat = false;
- void citire()
- {
- cin>>x>>y>>p;
- }
- }v[10001];
- int distP(int a, int b)
- {
- int x = v[a].x - v[b].x;
- int y = v[a].y - v[b].y;
- return (x*x + y*y);
- }
- void explode(int poz)
- {
- v[poz].explodat = true;
- for(int i = 1;i<=n;i++)
- {
- if(!v[i].explodat)
- {
- if(distP(poz,i) <= v[poz].p*v[poz].p)
- explode(i);
- }
- }
- }
- int main()
- {
- cin>>n>>I;
- for(int i = 1;i<=n;i++)
- v[i].citire();
- explode(I);
- int cnt = 0;
- for(int i = 1;i<=n;i++)
- if(!v[i].explodat)
- cnt++;
- cout << cnt;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement