Since I don’t have much experience in coding and I just do it for fun, I hope my code can bring you some happiness and understnading here…
This is just USACO 1.1, easy. But the problem afterwards are hard…
Just used for testing the input and output form of usaco testing system.
I wrote some not-elegant code for this problem. Anyway, I solved it after all.
- We transfer the letters into numbers.
- Then get the product $mod$ 47.
- If the result is equal to 27, output ‘go’, else output ‘stay’.
A little complicated, but we can still see it through easily.
- We need to establish a relationship between name array and money amount array, so I create a function called
- Since all the money should be given in an integer form. Then I created a function called
left_overreturns how much you left after you give off money.
give_overreturns how much you need to give off to others.
- So use
find_nameto locate the giver and the given, then use
left_overto determine the amount of money change.
This is a easy problem. Just match the days and $mod$ 7 to check and count the times.