I’m getting wrong answer for a few testcases
Birthday Paradox
@aiman.mumtaz
There were couple of problems in your code
- if the p == 1, you need to print 366, so it requires separate if
- rounding of wont work you need as it’ll convert 36.6 to 37 but 36.2 to 36 but in either case answer should be
37, thats why we will take sqrt in an integer and print that integer + 1
I have edited your code accordingly, please take a look at it and ask if anything isn’t clear
https://ide.codingblocks.com/s/204963
It’s working. Thanks a lot!!