Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

There are two types of egg cartons. One type contains 6 eggs and the other type contains 8 eggs. John wants to buy exactly n eggs. Help John find the minimum number of cartons he should buy. Input The first line of input contains a single integer T(1 ≤ T ≤ 100) the number of test cases. Followed by T lines, each line contains a single integer n (1 ≤ n ≤ 100). Output For each test case, print the minimum number of cartons John should buy. If there's no possible answer, print -1 instead. Sample test(s) input 3 20 24 15 output 3 3 -1

OpenStudy (anonymous):

I'm having trouble finding a proper algorithm for this, what i had so far is if i assume a*Cartoon1+b*Cartoon2=Number of eggs (where a and b are number of each cartoon) Therefor a+b is minimum amount of cartoons needed

OpenStudy (anonymous):

think john is an autist i mean all he needs to do is buy 2 more eggs like what the flutter how much of a jew is he

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!