Polygon Relationship Problem Code: POLYREL Codechef Solution

 #include <bits/stdc++.h>
using namespace std;

int main() {  
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin>>t;
  while(t--){
      int n;
      int x,y;
      cin>>n;
      for(int i=0;i<n;i++)
          cin>>x>>y;
      int ans=0;
      int nn=n;
      while(n){
          ans+=n;
          if(n<6)break;
          n>>=1;
      }
       cout<<ans<<'\n';

 }
}

Comments