Advertisement
YavorGrancharov

01. Anonymous Downsite(exam05.11)

Nov 5th, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace exam01
  9. {
  10.     class Program
  11.     {
  12.  
  13.         static void Main(string[] args)
  14.         {
  15.             BigInteger numberOfWebsites = BigInteger.Parse(Console.ReadLine());
  16.  
  17.             BigInteger securityKey = BigInteger.Parse(Console.ReadLine());
  18.  
  19.             int power = 0;
  20.             decimal siteLoss = 0M;
  21.             for (int i = 0; i < numberOfWebsites; i++)
  22.             {
  23.                 string input = Console.ReadLine();
  24.                 string[] tokens = input.Split(' ');
  25.                 string siteName = tokens[0];
  26.                 long siteVisits = long.Parse(tokens[1]);
  27.                 decimal siteCommercialPricePerVisit = decimal.Parse(tokens[2]);
  28.  
  29.                 siteLoss += siteVisits * siteCommercialPricePerVisit;
  30.                 Console.WriteLine(siteName);
  31.                 power++;
  32.             }
  33.             Console.WriteLine("Total Loss: {0:F20}", siteLoss);
  34.             Console.WriteLine("Security Token: {0}", BigInteger.Pow(securityKey,power));
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement