Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main() // 100/100
  5.     {
  6.         int count1Leva = int.Parse(Console.ReadLine());
  7.         int count2Leva = int.Parse(Console.ReadLine());
  8.         int count5Leva = int.Parse(Console.ReadLine());
  9.         int sum = int.Parse(Console.ReadLine());
  10.  
  11.         for (int i = 0; i <= count1Leva; i++)
  12.         {
  13.             for (int j = 0; j <= count2Leva; j++)
  14.             {
  15.                 for (int k = 0; k <= count5Leva; k++)
  16.                 {
  17.                     if (i * 1 + j * 2 + k * 5 == sum)
  18.                     {
  19.                         Console.WriteLine("{0} * 1 lv. + {1} * 2 lv. + {2} * 5 lv. = {3} lv.", i, j, k, sum);
  20.                     }
  21.                 }
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement