Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- string[] inputData = Console.ReadLine().Split('.', ' ');
- int dd = int.Parse(inputData[0]);
- int mm = int.Parse(inputData[1]);
- int yyyy = int.Parse(inputData[2]);
- string userName = (inputData[3]);
- long result = dd * mm * yyyy;
- if (mm % 2 != 0 )
- {
- result *= result;
- }
- foreach (var symbol in userName)
- {
- if (symbol >= '0' && symbol <='9')
- {
- result += symbol - '0';
- }
- else if (symbol>='a' && symbol <= 'z')
- {
- result += symbol - 'a' + 1;
- }
- else if (symbol >= 'A' && symbol <= 'Z')
- {
- result += 2*(symbol - 'A' + 1);
- }
- }
- while (result > 13)
- {
- int digitSum = 0;
- while (result > 0)
- {
- digitSum += (int)(result % 10);
- result /= 10;
- }
- result = digitSum;
- }
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment