Advertisement
Guest User

Untitled

a guest
Mar 10th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.26 KB | None | 0 0
  1. namespace Numerology
  2. {
  3.     using System;
  4.     using System.Collections.Generic;
  5.     using System.Linq;
  6.     using System.Text;
  7.     using System.Threading.Tasks;
  8.     class Numerology
  9.     {
  10.         static void Main()
  11.         {
  12.             string date = Console.ReadLine();
  13.             string name = Console.ReadLine();
  14.             string newName = string.Empty;
  15.             for (int i = 0; i < name.Length; i++)
  16.             {
  17.                 newName += name[i] + " ";
  18.             }
  19.  
  20.             List<string> nameList = newName.Split(' ').ToList();
  21.             List<string> sum = date.Split('.').ToList();
  22.  
  23.             long multipy = 1;
  24.             foreach (var item in sum)
  25.             {
  26.                 multipy *= long.Parse(item);
  27.             }
  28.             long anotherMultiply = 1;
  29.             if (long.Parse(sum[1]) % 2 != 0)
  30.             {
  31.                 anotherMultiply = multipy * multipy;
  32.                 multipy = anotherMultiply;
  33.             }
  34.  
  35.             var alphabet = new List<string>() { "#", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
  36.                 "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
  37.             var upAlphabet = new List<string>() { "#", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
  38.                 "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
  39.             var numbers = new List<string>() { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
  40.  
  41.             for (int i = 0; i < nameList.Count; i++)
  42.             {
  43.                 if (alphabet.Contains(nameList[i]))
  44.                 {
  45.                     multipy += alphabet.IndexOf(nameList[i]);
  46.                 }
  47.                 else if(upAlphabet.Contains(nameList[i]))
  48.                 {
  49.                     multipy += upAlphabet.IndexOf(nameList[i]) * 2;
  50.                 }
  51.                 else if (numbers.Contains(nameList[i]))
  52.                 {
  53.                     multipy += numbers.IndexOf(nameList[i]);
  54.                 }
  55.             }
  56.  
  57.             long result = 0;
  58.             while (multipy > 13)
  59.             {
  60.                 result = multipy.ToString().Sum(c => c - '0');
  61.                 multipy = result;
  62.             }
  63.  
  64.             Console.WriteLine(result);
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement