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;
- using System.Text.RegularExpressions;
- using System.Numerics;
- class Exam
- {
- static void Main()
- {
- string letters = Console.ReadLine();
- int oddJump = int.Parse(Console.ReadLine());
- int evenJump = int.Parse(Console.ReadLine());
- letters = letters.ToLower();
- letters = Regex.Replace(letters, "\\s+", "");
- int[] odd = new int[letters.Length / 2];
- int[] even = new int[letters.Length / 2];
- BigInteger resultodd = 0;
- BigInteger resulteven = 0;
- int counter = 0;
- int counter1 = 0;
- if ((oddJump>1&evenJump>1)&(oddJump<=100&evenJump<=100))
- {
- for (int i = 0, k = 0, j = 1; i < letters.Length; k++, i += 2, j += 2)
- {
- odd[k] = letters[i];
- even[k] = letters[j];
- }
- for (int o = 0, e = 1; o < odd.Length; o++, e++)
- {
- if (e % oddJump == 0)
- {
- resultodd *= odd[o];
- o++;
- e++;
- }
- if (o == odd.Length)
- {
- break;
- }
- resultodd += odd[o];
- }
- for (int o = 0, e = 1; o < even.Length; o++, e++)
- {
- if (e % evenJump == 0)
- {
- resulteven *= even[o];
- o++;
- e++;
- }
- if (o == even.Length)
- {
- break;
- }
- resulteven += even[o];
- }
- Console.WriteLine("Odd: {0:X}", resultodd);
- Console.WriteLine("Even: {0:X}", resulteven);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement