 # Contest : Campus Code October Edition Coding Competition | CodeChef

Author: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Tester: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Editorialist: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9

Medium

# PROBLEM:

There are many towers made up of circular discs of height 1 unit. You can think of discs as Circles. (consider the top view).

## Tower’s description:

• A tower is made up of discs stacked on top of each other (from top view it will look like circles inside of circles).
• Each disc can only have one disc directly on top (the tower has only one peak).
• The disc on top is completely inside the bottom disc ( no circles intersect each other).
• The disc on top must be smaller than the bottom disc.
The discs are placed in a 2D - coordinate plane. You are given the center position and radius of each disc.
Find the height of the tallest tower.

EXPLANATION:
find height of tallest tower according to the conditions given.

SOLUTION:
C++:

#include<bits/stdc++.h>

using namespace std;

#define loop(i,l,h) for(int i=l;i<h;i++)
#define endl “\n”

typedef long long int ll;
typedef long double ld;

int main(){

``````ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t=0;

do{
int n;cin>>n;
int arr[n];
for(int i=0;i<n;i++){
int x,y,r;cin>>x>>y>>r;
arr[i]=x;
arr[i]=y;
arr[i]=r;
}
int res=1;
for(int i=0;i<n;i++){
int tmp=1;
for(int j=0;j<n;j++){
int x=0;
if(i !=j){
if((arr[i]+arr[i]) > (arr[j]+arr[j]) && (arr[i]-arr[i]) < (arr[j]-arr[j]) ){
x++;
}

if((arr[i]+arr[i]) > (arr[j]+arr[j]) && (arr[i]-arr[i]) < (arr[j]-arr[j])){
x++;
}
}
if(x==2)tmp++;
}
res=max(tmp,res);
}
cout<<res<<endl;
}while(t--);

return 0;
``````

}