Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CSGO {
- public static void main(String[] agrs) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int money = Integer.parseInt(scanner.nextLine());
- int totalMoney = 0;
- if (n > 7) {
- System.out.println("Sorry, you can't carry so many things!");
- } else {
- for (int i = 0; i < n; i++) {
- String gun = scanner.nextLine();
- if (gun.equals("ak47")) {
- totalMoney += 2700;
- } else if (gun.equals("awp")) {
- totalMoney += 4750;
- } else if (gun.equals("sg553")) {
- totalMoney += 3500;
- } else if (gun.equals("grenade")){
- totalMoney += 300;
- }else if (gun.equals("flash")){
- totalMoney += 250;
- }else if (gun.equals("glock")){
- totalMoney += 500;
- }else if (gun.equals("bazooka")){
- totalMoney += 5600;
- }
- }
- if (totalMoney <= money){
- System.out.printf("You bought all %d items! Get to work and defeat the bomb!", n);
- } else {
- System.out.printf("Not enough money! You need %d more money.", totalMoney - money);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement