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;
- class Program
- {
- static void Main(string[] args)
- {
- int numeralSystem = int.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- int totalValue = 0;
- string convertedValue = "";
- for (int i = 0; i < input.Length; i++)
- {
- if (input[i] >= 'A' && input[i] <= 'Z' )
- {
- totalValue += input[i] - 64;
- }
- else if (input[i] >= 'a' & input[i] <= 'z' )
- {
- totalValue += input[i] - 96;
- }
- else
- {
- totalValue += input[i];
- }
- }
- do
- {
- convertedValue = (totalValue % numeralSystem) + convertedValue;
- totalValue /= numeralSystem;
- }
- while (totalValue != 0);
- Console.WriteLine(numeralSystem.ToString()+input.Length + convertedValue);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment