Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace TheSecretOfNumbers
- {
- class TheSecretOfNumbers
- {
- static void Main()
- {
- int sum = 0;
- int br = 0;
- int num = int.Parse(Console.ReadLine());
- int number = num;
- int []arr;
- arr = new int [30];
- // List<int> listOfInts = new List<int>();
- // while (num > 0)
- // {
- // listOfInts.Add(num % 10);
- // num = num / 10;
- // br++;
- // }
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = num % 10;
- num = num / 10;
- br++;
- }
- //for (int i = 0; i < br; i++)
- //{
- // if (i % 2 == 0)
- // {
- // sum += listOfInts[i] * (int)Math.Pow((i + 1), 2);
- // }
- // else
- // {
- // sum += (int)Math.Pow(listOfInts[i], 2) * (i + 1);
- // }
- //}
- for (int i = 0; i < arr.Length; i++)
- {
- if (i % 2 == 0)
- {
- sum += arr[i] * (int)Math.Pow((i + 1), 2);
- }
- else
- {
- sum += (int)Math.Pow(arr[i], 2) * (i + 1);
- }
- }
- Console.WriteLine(sum);
- int secret = sum % 26;
- if (sum % 10 == 0)
- {
- Console.WriteLine("{0} has no secret alpha-sequence", number);
- }
- else
- {
- for (int i = 0; i < sum % 10; i++)
- {
- int toPrint = 'A' + secret + i;
- if (toPrint <= 'Z')
- {
- Console.Write((char)toPrint);
- }
- else
- {
- Console.Write((char)(toPrint - 26));
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement