๐Ÿ“ฆ Ops

Ration Arithmetic

Stardate 55114.9 ยท UES Magnanimous

Briefing

Each ration crate feeds forty person-days: one person for forty days, forty people for one day, or any arrangement in between. The Captain has asked how long the current stores will last, and the computer has answered "9.756 days". The Captain does not want the point seven five six. The Captain wants to know whether to order more.

Chief T'Kala points out that a partial day is not a day anyone gets fed on, so the answer should round down. Ensign Tannenbaum suggested rounding to the nearest, "for morale". This was overruled by everyone present, including Gerald.

Mission objectives

ARCHIE checks all five every time you run diagnostics.

  • โ€ขTen crates for a crew of forty last exactly ten days
  • โ€ขTen crates for forty-one people: nine days, because a partial day does not count
  • โ€ขNo crates, no days
  • โ€ขSeven crates for twenty people last fourteen days
  • โ€ขOne crate for eighty people is zero whole days
Ask Commander Raghunathan for a hint

Total person-days is crates times forty. Divide by the crew size and keep only the whole number: // in Python, plain / on integers in Rust, which already discards the remainder.