← ~/bài tập
P2000

Sum of Digits

Easy
// Đề bài
Given a non-negative integer n, output the sum of its decimal digits.
// Đầu vào
A single line containing one integer n (0 <= n <= 10^18).
// Đầu ra
A single integer: the sum of the decimal digits of n.
// Gợi ý
Read the number as a string and add up the characters.
// Ví dụ
Đầu vào ví dụ
12345
Đầu ra ví dụ
15
// Thông tin bài tập
Độ khóEasy
Tỉ lệ chấp nhận50%
Giới hạn thời gian1000 ms
Giới hạn bộ nhớ65536 KB
Được chấp nhận5