Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- using System.Text;
- class PetersGame
- {
- static void Main()
- {
- BigInteger starting = BigInteger.Parse(Console.ReadLine()); //10
- BigInteger end = BigInteger.Parse(Console.ReadLine()); //14
- string replacement = Console.ReadLine(); //a
- BigInteger sum = 0;
- string replays = string.Empty;
- string result = string.Empty;
- for (BigInteger i = starting; i < end; i++)
- {
- if (i % 5 == 0)
- {
- sum += i;
- }
- else
- {
- sum += i % 5;
- }
- if (sum % 2 == 0)
- {
- replays = sum.ToString()[0].ToString();
- }
- else
- {
- replays = sum.ToString()[sum.ToString().Length - 1].ToString();
- }
- result = sum.ToString().Replace(replays, replacement);
- }
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement