HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50341 - Separate Into Digits

Guest
• Review clarifications (1)

Section problems

• 50242 - Numbers whose sum of the...
• 50248 - Power of two
• 50641 - Strong Prime Power
• 50249 - Ladders
• 50247 - Missing numbers
• 50267 - Interesting permutations
• 50640 - Cubes
• 50377 - kth Permutation
• 50341 - Separate Into Digits
• 50424 - Area
• 50335 - Five Math Operators
• 50299 - Median
• 50301 - Fractions to Decimals
• 50304 - Number Pattern
• 50305 - John's Tasks
• 50649 - Puzzle
• 50321 - Missing Number

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
bfs.

Separate Into Digits

Write a program that inputs one four-digit number, separates the number into its individual digits. Then, it prints digits separated by a space. And then, it prints the sum of digits in a new line.

Input specification
You will be given an integer number (num) where 1000 ≤ num ≤ 9999

Output specification
Show every digit in order in a line. Then show the sum of digits in the second line.

Sample Input I
  4367
Sample Input II
  5840
Sample Output I
  4 3 6 7
  20
Sample Output II
  5 8 4 0
  17


Для отправки решений необходимо выполнить вход.

www.contester.ru