Advertisement
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;
- namespace Problem2
- {
- class Decoding
- {
- static void Main(string[] args)
- {
- int salt = int.Parse(Console.ReadLine());
- double result = 0;
- var encodedNumbers = new List<double>();
- string text = Console.ReadLine();
- for (int i = 0; i < text.Length; i++)
- {
- if (text[i] == '@')
- {
- break;
- }
- else if (char.IsLetter(text[i]))
- {
- result = (int)text[i] * salt + 1000;
- if (i % 2 == 0)
- {
- result /= 100.0;
- Console.WriteLine("{0:F2}", result);
- }
- else
- {
- result *= 100;
- Console.WriteLine(result);
- }
- }
- else if (char.IsDigit(text[i]))
- {
- result = (int)text[i] + salt + 500;
- if (i % 2 == 0)
- {
- result /= 100.0;
- Console.WriteLine("{0:F2}", result);
- }
- else
- {
- result *= 100;
- Console.WriteLine(result);
- }
- }
- else
- {
- result = (int)text[i] - salt;
- if (i % 2 == 0)
- {
- result /= 100.0;
- Console.WriteLine("{0:F2}", result);
- }
- else
- {
- result *= 100;
- Console.WriteLine(result);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement