Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- class Program
- {
- static void Main(string[] args)
- {
- string number = Console.ReadLine();
- BigInteger product = 1;
- if (number.Length == 1)
- {
- Console.WriteLine(0);
- Console.WriteLine(number);
- return;
- }
- int numberLength = number.Length - 1;
- long numberOfTransformations = 1;
- long actualSum = 0;
- bool whileToContinue = true;
- while (true)
- {
- if (numberLength <= 1)
- {
- product *= number[0] - '0';
- number = product.ToString();
- numberLength = number.Length;
- if (numberLength > 1)
- {
- numberLength--;
- whileToContinue = true;
- numberOfTransformations++;
- if (numberOfTransformations != 11)
- {
- product = 1;
- }
- else
- {
- Console.WriteLine(number);
- break;
- }
- }
- else
- {
- Console.WriteLine(numberOfTransformations);
- Console.WriteLine(number);
- whileToContinue = false;
- break;
- }
- }
- else if (whileToContinue)
- {
- for (int i = 0; i < numberLength; i+= 2)
- {
- if (i % 2 == 0)
- {
- actualSum += number[i] - '0';
- }
- }
- numberLength--;
- product *= actualSum;
- actualSum = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement