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.Numerics;
- namespace _01_AMericanPie
- {
- class Program
- {
- static void Main(string[] args)
- {
- BigInteger A = BigInteger.Parse(Console.ReadLine());
- //int A = 2; BigInteger
- BigInteger B = BigInteger.Parse(Console.ReadLine());
- //int B = 4; BigInteger
- BigInteger C = BigInteger.Parse(Console.ReadLine());
- //int C = 2; BigInteger
- BigInteger D = BigInteger.Parse(Console.ReadLine());
- //int D = 3;
- BigInteger G = B * D;
- BigInteger nominatorAAdd = G / B;
- A = A * nominatorAAdd;
- BigInteger nominatorCAdd = G / D;
- C = C * nominatorCAdd;
- BigInteger F = A + C;
- BigInteger numberOfFullPies = F / G;
- if (numberOfFullPies > 0)
- {
- Console.WriteLine(numberOfFullPies);
- Console.WriteLine("{0}/{1}", F, G);
- }
- else if (numberOfFullPies == 0)
- {
- decimal halfPie = (decimal)F / (decimal)G;
- Console.WriteLine("{0:F20}", halfPie);
- Console.WriteLine("{0}/{1}", F, G);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement