answer will be upvoted else downvoted.   number is called 2050-number if it is 2050, 20500, ..., (2050⋅10k for integer k≥0).   Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers required for that.   Input The first line contains a

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question

Correct answer will be upvoted else downvoted.

 

number is called 2050-number if it is 2050, 20500, ..., (2050⋅10k for integer k≥0).

 

Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-numbers required for that.

 

Input

The first line contains a single integer T (1≤T≤1000) denoting the number of test cases.

 

The only line of each test case contains a single integer n (1≤n≤1018) denoting the number to be represented.

 

Output

For each test case, output the minimum number of 2050-numbers in one line.

 

If n cannot be represented as the sum of 2050-numbers, output −1 instead.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr