codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1958A.md (1490B)


      1 Source: https://codeforces.com/problemset/problem/1958/A
      2 
      3 A. 1-3-5
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 512 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 In Berland, coins of worth $1$, $3$ and $5$ burles are commonly used (burles are local currency).
     22 
     23 Eva has to pay exactly $n$ burles in a shop. She has an infinite amount of coins of all three types. However, she doesn't like to pay using coins worth $1$ burle — she thinks they are the most convenient to use.
     24 
     25 Help Eva to calculate the minimum number of coins worth $1$ burle she has to use, if she has to pay exactly $n$ burles. Note that she can spend any number of coins worth $3$ and/or $5$ burles.
     26 
     27 Input
     28 
     29 The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.
     30 
     31 Each test case consists of one line, containing one integer $n$ ($1 \le n \le 100$).
     32 
     33 Output
     34 
     35 For each test case, print one integer — the minimum number of $1$-burle coins Eva has to use.
     36 
     37 Example
     38 
     39 Input
     40 
     41 ```
     42 5
     43 
     44 7
     45 
     46 8
     47 
     48 42
     49 
     50 2
     51 
     52 11
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 1
     59 0
     60 0
     61 2
     62 0
     63 ```
     64 
     65 Note
     66 
     67 In the first test case, Eva should use $1$ coin worth $1$ burle, and $2$ coins worth $3$ burles.
     68 
     69 In the second test case, Eva should use $1$ coin worth $3$ burles and $1$ coin worth $5$ burles.
     70 
     71 In the third test case, Eva should use $14$ coins worth $3$ burles.
     72 
     73 In the fourth test case, Eva should use $2$ coins worth $1$ burle.
     74 
     75 In the fifth test case, Eva should use $2$ coins worth $3$ burles and $1$ coin worth $5$ burles.