BorislavBorisov

17.05.Garden друго решение

Sep 29th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.08 KB | None | 0 0
  1. using System;
  2. class Garden
  3. {
  4.     static void Main()
  5.     {
  6.         decimal seeds = 0m;
  7.         int area = 0;
  8.         for (int i = 0; i < 11; i++)
  9.         {
  10.             decimal input = decimal.Parse(Console.ReadLine());
  11.             if(i == 0 || i == 1)
  12.             {
  13.                 if(i == 0)
  14.                 {
  15.                     seeds += input * 0.5m;
  16.                 }
  17.                 else
  18.                 {
  19.                     area += (int)input;
  20.                 }
  21.             }
  22.             if (i == 2 || i == 3)
  23.             {
  24.                 if (i == 2)
  25.                 {
  26.                     seeds += input * 0.4m;
  27.                 }
  28.                 else
  29.                 {
  30.                     area += (int)input;
  31.                 }
  32.             }
  33.             if (i == 4 || i == 5)
  34.             {
  35.                 if (i == 4)
  36.                 {
  37.                     seeds += input * 0.25m;
  38.                 }
  39.                 else
  40.                 {
  41.                     area += (int)input;
  42.                 }
  43.             }
  44.             if (i == 6 || i == 7)
  45.             {
  46.                 if (i == 6)
  47.                 {
  48.                     seeds += input * 0.6m;
  49.                 }
  50.                 else
  51.                 {
  52.                     area += (int)input;
  53.                 }
  54.             }
  55.             if (i == 8 || i == 9)
  56.             {
  57.                 if (i == 8)
  58.                 {
  59.                     seeds += input * 0.3m;
  60.                 }
  61.                 else
  62.                 {
  63.                     area += (int)input;
  64.                 }
  65.             }
  66.             if (i == 10)
  67.             {
  68.                 seeds += input * 0.4m;
  69.             }
  70.         }
  71.         Console.WriteLine("Total costs: " + seeds);
  72.         int beansArea = 250 - area;
  73.  
  74.         if(beansArea > 0)
  75.         {
  76.             Console.WriteLine("Beans area: " + beansArea);
  77.         }
  78.         else if(beansArea == 0)
  79.         {
  80.             Console.WriteLine("No area for beans");
  81.         }
  82.         else
  83.         {
  84.             Console.WriteLine("Insufficient area");
  85.         }
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment