BTW - they were in the Ark more than 40 days. 40 days was just how long the rains fell, but the flood continued much longer than that. The story describes the length of time in the ark in two ways:
First, it specifies that the rains fell for 40 days, and then there was a 150-day period during which the waters receded (Gen 8:3), an unspecified period in which they continued to recede (Gen 8:5) and then a 47-day period until Noah found signs of land again (Gen 8:6-11), another week (Gen 8:12) and then another unspecified period of time until they came out of the Ark. This adds up to at least 237 days, not counting the time periods where no specific length is given.
Second, it says that they boarded the Ark "in the six hundredth year of Noah's life, on the seventeenth day of the second month" (Gen 7:11) and then didn't come out again until the twenty-seventh day of the second month of Noah's six hundred and first year (Gen 8:13-17).
In the Hebrew calendar, months are either 29 or 30 days and there are twelve months in a non-leap year, so at an average of 29.5 days per month, this would make the total time something around 364 days: one lunar year of 12 months (354 days) plus a 10 day remainder (from the 17th to the 27th of the month).
Either way, you'd be looking at spending a year or slightly less on the Ark if you wanted to do things exactly Biblically.