Public submissions
Source code of every submission to this problem in this contest
will be visible for everyone since 2013-02-21 06:00:00.
Submit | All submissions | Best solutions | Back to list |
EGGC - Egg Cartons |
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. Find and print the minimal number of egg cartons he must buy. If it's impossible to buy exactly n eggs, print -1. n will be between 1 and 100, inclusive.
Input Specification
The input will contain several test cases, each test cases will be in a single line with the given integer n.
Output Specification
Print one line per test case with the answer, follow the format below
Input Example
20
24
15
4
Output Example
3
3
-1
-1
Added by: | Fabio Avellaneda |
Date: | 2013-02-02 |
Time limit: | 3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 JAVA |
Public source code since: | 2013-02-21 06:00:00 |