Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- public static void Main(string[] args)
- {
- ulong n, a, b;
- ulong deductibleAmount = 0;
- var input = Console.ReadLine();
- if (input == null) return;
- n = Convert.ToUInt64(input.Split(" ")[0]);
- a = Convert.ToUInt64(input.Split(" ")[1]);
- b = Convert.ToUInt64(input.Split(" ")[2]);
- ulong summaToN = (1 + n) * n / 2;
- for (ulong i = a; i <= n; i += a)
- {
- deductibleAmount += i;
- }
- for (ulong i = b; i <= n; i += b)
- {
- if (i % a != 0)
- {
- deductibleAmount += i;
- }
- }
- Console.WriteLine(summaToN - deductibleAmount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement