Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution
- {
- static void Main(string[] args)
- {
- var r1 = int.Parse(Console.ReadLine());
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- Console.Error.WriteLine(r1);
- Console.WriteLine(calcNbPrec(r1)?"YES":"NO");
- }
- static bool calcNbPrec(int nombre){
- int i = 1;
- while(i<nombre && nombre != calcNombre(i)){
- i++;
- }
- return i<nombre;
- }
- static int calcNombre(int nombre){
- var str =""+nombre;
- str.ToArray().ToList().ForEach(_=> nombre += int.Parse(""+_));
- return nombre;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement