数位之和
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
小 Z 正在做口算练习。老师给出一个正整数 ,让他算出这个数各个数位上的数字之和。
例如 时,各位数字依次是 ,它们的和是 。
请你写一个程序帮小 Z 算一算。
输入格式
一行一个正整数 。
输出格式
一行一个整数,表示 各位数字之和。
2026
10
7
7
1000000
1
数据范围与提示
【样例解释】
- 样例 1:。
- 样例 2: 只有一位,答案就是它本身,。
- 样例 3: 的各位数字是 ,和是 。
【数据范围】
对于所有测试数据,保证 。
HIL2026年9月启蒙组
- Status
- Done
- Rule
- IOI
- Problem
- 4
- Start at
- 2026-9-28 10:30
- End at
- 2026-10-6 18:30
- Duration
- 200 hour(s)
- Host
- Partic.
- 0