Advertisement
Sim0o0na

4. CSGO

Mar 12th, 2018
2,801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Zad4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numberOfWeapons = int.Parse(Console.ReadLine());
  14.             int nikiMoney = int.Parse(Console.ReadLine());
  15.  
  16.             if (numberOfWeapons > 7)
  17.             {
  18.                 Console.WriteLine("Sorry, you can't carry so many things!");
  19.                 return;
  20.             }
  21.  
  22.             int totalWeaponCost = 0;
  23.  
  24.             for (int i = 0; i < numberOfWeapons; i++)
  25.             {
  26.                 string weapon = Console.ReadLine();
  27.                
  28.                 if (weapon == "ak47")
  29.                 {
  30.                     totalWeaponCost += 2700;
  31.                 }
  32.                 else if (weapon == "awp")
  33.                 {
  34.                     totalWeaponCost += 4750;
  35.                 }
  36.                 else if (weapon == "sg553")
  37.                 {
  38.                     totalWeaponCost += 3500;
  39.                 }
  40.                 else if (weapon == "grenade")
  41.                 {
  42.                     totalWeaponCost += 300;
  43.                 }
  44.                 else if (weapon == "flash")
  45.                 {
  46.                     totalWeaponCost += 250;
  47.                 }
  48.                 else if (weapon == "glock")
  49.                 {
  50.                     totalWeaponCost += 500;
  51.                 }
  52.                 else if (weapon == "bazooka")
  53.                 {
  54.                     totalWeaponCost += 5600;
  55.                 }
  56.             }
  57.  
  58.             if (totalWeaponCost > nikiMoney)
  59.             {
  60.                 Console.WriteLine($"Not enough money! You need {totalWeaponCost - nikiMoney} more money.");
  61.             }
  62.             else
  63.             {
  64.                 Console.WriteLine($"You bought all {numberOfWeapons} items! Get to work and defeat the bomb!");
  65.             }
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement