Skip to content

Instantly share code, notes, and snippets.

@tjk
Forked from jroesch/pizza.hs
Created October 13, 2012 03:03
Show Gist options
  • Save tjk/3883055 to your computer and use it in GitHub Desktop.
Save tjk/3883055 to your computer and use it in GitHub Desktop.
ACM Micro-Challenge 1
int
num_pizzas(unsigned int num_people, unsigned int slices_per_pizza, unsigned int time)
{
unsigned int num_slices;
num_slices = num_people;
if (11 <= time && time <= 22)
num_slices *= 2;
return (int)(num_slices / (float)slices_per_pizza + 1);
}
int
main(void)
{
return num_pizzas(5, 10, 22); // answer in $?
}
@tjk
Copy link
Author

tjk commented Oct 14, 2012

woops forked this off of @jroesch instead of @andrewberls...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment