Problem 3759 --Sum of 2050

3759: Sum of 2050

"
Time Limit $1$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 数学
A number is called 2050-number if it is 205020502050020500, ..., (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.

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.

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.

6
205
2050
4100
20500
22550
25308639900
-1
1
2
1
2
36
Note

In the third case, 4100=2050+2050.

In the fifth case, 22550=20500+2050.

推荐代码 查看3759 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 Contest 2050 and Codeforces Round #718 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛