Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Numerology
- {
- class Numerology
- {
- static void Main()
- {
- string input = Console.ReadLine();
- string[] splitInput = input.Split(' ', '.');
- UInt64 dateProduct = Convert.ToUInt64(splitInput[0].ToString()) *
- Convert.ToUInt64(splitInput[1].ToString())
- * Convert.ToUInt64(splitInput[2].ToString());
- if (Convert.ToUInt64(splitInput[1].ToString()) % 2 != 0)
- {
- dateProduct *= dateProduct;
- }
- UInt64 usernameWeight = 0;
- Dictionary<char,int> dict = new Dictionary<char, int>();
- char smallLetter = 'a';
- char bigLetter = 'A';
- for (int i = 1; i <= 26; i++,smallLetter++,bigLetter++)
- {
- dict.Add(smallLetter,i);
- dict.Add(bigLetter,i*2);
- }
- for (int i = 0; i < splitInput[3].Length; i++)
- {
- if (dict.ContainsKey(splitInput[3][i]))
- {
- usernameWeight += Convert.ToUInt64(dict[splitInput[3][i]]);
- }
- else
- {
- usernameWeight += Convert.ToUInt64(splitInput[3][i].ToString());
- }
- }
- UInt64 initialSum = usernameWeight + dateProduct;
- while (initialSum > 13)
- {
- int[] nums = Array.ConvertAll(initialSum.ToString().ToArray(), x => (int)x - 48);
- initialSum = Convert.ToUInt64(nums.Sum());
- }
- Console.WriteLine(initialSum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment