Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

HO1050 - Хуваагдал 5

Тооны цифрүүдийн нийлбэрийг олоод гарсан тоо нь 10-с их бол дахин цифрүүдийн нийлбэрийг олох гэх мэт 1 оронтой тоо гартал нэм. Хамгийн сүүлд олдсон тоог ол. Жишээ нь: 12568 гэж өгөгдөхөд 1+2+5+6+8=22   2+2=4 хариу нь: 4 болно.

Input

N тоо өгөгдөнө. (N<=10^9)

Output

Нэг оронтой тоог хэвлэ.

Example

Input:
12568

Output:
4

Нэмсэн:munkhbat
Огноо:2013-01-14
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:Бүгд дараах хэлүүдээс бусад: ASM64 NCSHARP JULIA PYPY3

hide comments
2023-06-06 14:01:37
#include <stdio.h>
#include <stdlib.h>
int main ()
{int a,b,c,g,k;
scanf ("%d",&c);
while (c>=9) {
k=c;
b=0;
while (k>=1){
a=k%10;
b=a+b;
k=k/10;
}
c=b;
}
printf ("%d",b);
}
2023-04-10 16:57:26
#include <stdio.h>
#include <stdlib.h>
int main ()
{int a,b,c,g,k;
scanf ("%d",&c);
while (c>=9) {
k=c;
b=0;
while (k>=1){
a=k%10;
b=a+b;
k=k/10;
}
c=b;
}
printf ("%d",b);
} munji
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.