Advertisement
North_Point

Untitled

Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _06.Batteries
  6. {
  7.     class Batteries
  8.     {
  9.         static void Main()
  10.         {
  11.             var capacities = Console.ReadLine()
  12.                 .Split(' ')
  13.                 .Select(double.Parse)
  14.                 .ToList();
  15.  
  16.             var usegePerHower = Console.ReadLine()
  17.                 .Split(' ')
  18.                 .Select(double.Parse)
  19.                 .ToList();
  20.  
  21.             double howerStresTest = double.Parse(Console.ReadLine());
  22.  
  23.             var usegePlusHower = new List<double>();
  24.             var result = new List<double>();
  25.             for (int i = 0; i < usegePerHower.Count; i++)
  26.             {
  27.                 double index = usegePerHower[i] * howerStresTest;
  28.                 usegePlusHower.Add(index);
  29.  
  30.                 result.Add(capacities[i] - usegePlusHower[i]);
  31.                 if (result[i] <= 0)
  32.                 {
  33.                     Console.WriteLine("Battery {0}: dead (lasted {1} hours)", result.Count, (Math.Ceiling(capacities[i] / usegePerHower[i])));// TODO PER HOW MACH HOWERS!!!!!!!!!
  34.                     // result.RemoveAt(i); -  с това гърми с remove() - също
  35.                 }
  36.                 else
  37.                 {
  38.                     Console.WriteLine("Battery {0}: {1} mAh ({2})%", result.Count,
  39.                         string.Join(" ", result[i].ToString("0.00")), ((result[i] / capacities[i]) * 100).ToString("0.00"));
  40.                 }
  41.                
  42.             }
  43.  
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement