Here is my code
#include<bits/stdc++.h>
using namespace std;
double findProb(int people){
double ans = 1;
double n = 365;
for(int i = 0;i<people;i++)
ans = ans * ((n-i)/365);
return 1-ans;
}
int main(){
double probablity;
cin>>probablity;
int low = 1,high = 366,ans = 366;
while (low<=high){
int mid = (low+high)/2;
if(findProb(mid) >= probablity){
ans = mid;
high = mid-1;
}
else{
low = mid+1;
}
}
cout<<ans;
return 0;
}