Algorithm


Problem Name: beecrowd | 2582

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2582

System of a Download

 

By Ricardo Martins, IFSULDEMINAS BR Brazil

Timelimit: 1

System of a Download is a famous Hacker Metal band! Once, they created a device, with six buttons, numbered from 0 to 5, and put in that device their 11 greatest hits. To play one of these songs, you have to press two buttons. With this, the numbers of these two buttons are added, and then the corresponding song is played. Number of the sum, according to the relation below:

0 - PROXYCITY
1 - P.Y.N.G.
2 - DNSUEY!
3 - SERVERS
4 - HOST!
5 - CRIPTONIZE
6 - OFFLINE DAY
7 - SALT
8 - ANSWER!
9 - RAR?
10 - WIFI ANTENNAS

For example, if the pressed buttons are 3 and 4, it will play the song 7 - SALT

Write a program that, given the two buttons that are pressed, determines which song will play.

 

Input

 

An integer C will be informed, which will be the number of test cases. Each case has two integer values, X and Y, representing which buttons have been pressed.

 

Output

 

For each test case, print the name of the corresponding song.

 

 

 

Input Sample Output Sample

3
3 4
0 0
1 0

SALT
PROXYCITY
P.Y.N.G.

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main(void)

{
    int a, b, n, i, x;

    scanf("%i", &n);

    for (i = 0; i < n; ++i)
    {

    scanf("%i %i", &a, &b);

    x=a+b;

    switch(x)
    {
    case 0:
        printf("PROXYCITY\n");
        break;

    case 1:
        printf("P.Y.N.G.\n");
        break;

    case 2:
        printf("DNSUEY!\n");
        break;

    case 3:
        printf("SERVERS\n");
        break;

    case 4:
        printf("HOST!\n");
        break;

    case 5:
        printf("CRIPTONIZE\n");
        break;

    case 6:
        printf("OFFLINE DAY\n");
        break;

    case 7:
        printf("SALT\n");
        break;

    case 8:
        printf("ANSWER!\n");
        break;

    case 9:
        printf("RAR?\n");
        break;

    case 10:
        printf("WIFI ANTENNAS\n");
        break;
    }
    }
}

Copy The Code & Try With Live Editor

Input

x
+
cmd
3 3 4 0 0 1 0

Output

x
+
cmd
SALT PROXYCITY P.Y.N.G.

#2 Code Example with C++ Programming

Code - C++ Programming


#include<iostream>
using namespace std;
int main()
{
   int a;
   cin >> a;
   while(a--){
        int x,y;
        cin >> x >> y;
        x = x+y;
        if(x == 0)
             cout << "PROXYCITY\n";
      else if(x == 1)
             cout << "P.Y.N.G.\n";
     else if(x == 2)
             cout << "DNSUEY!\n";
       else if(x == 3)
             cout << "SERVERS\n";
      else if(x == 4)
             cout << "HOST!\n";
     else if(x == 5)
             cout << "CRIPTONIZE\n";
    else if(x == 6)
             cout << "OFFLINE DAY\n";
    else if(x == 7)
             cout << "SALT\n";
    else if(x == 8)
             cout << "ANSWER!\n";
    else if(x == 9)
             cout << "RAR?\n"; 
    else if(x == 10)
             cout << "WIFI ANTENNAS\n";
    }
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 3 4 0 0 1 0

Output

x
+
cmd
SALT PROXYCITY P.Y.N.G.

#3 Code Example with Java Programming

Code - Java Programming


import java.util.Scanner;
import java.util.Locale;
public class Main {
	public static void main(String[] args) {
		Locale.setDefault(new Locale("en", "US"));
		Scanner sc = new Scanner(System.in);
		
		int escolha1,escolha2;
		int n = sc.nextInt();
		for (int i = 0 ; i< n ; i++){
			escolha1 = sc.nextInt();
			escolha2 = sc.nextInt();
			if(escolha1+escolha2==0) System.out.println("PROXYCITY");
			else if(escolha1+escolha2==1) System.out.println("P.Y.N.G.");
			else if(escolha1+escolha2==2) System.out.println("DNSUEY!");
			else if(escolha1+escolha2==3) System.out.println("SERVERS");
			else if(escolha1+escolha2==4) System.out.println("HOST!");
			else if(escolha1+escolha2==5) System.out.println("CRIPTONIZE");
			else if(escolha1+escolha2==6) System.out.println("OFFLINE DAY");
			else if(escolha1+escolha2==7) System.out.println("SALT");
			else if(escolha1+escolha2==8) System.out.println("ANSWER!");
			else if(escolha1+escolha2==9) System.out.println("RAR?");
			else if(escolha1+escolha2==10) System.out.println("WIFI ANTENNAS");
		}
		
		sc.close();
	}
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 3 4 0 0 1 0

Output

x
+
cmd
SALT PROXYCITY P.Y.N.G.

#4 Code Example with Javascript Programming

Code - Javascript Programming


const { readFileSync } = require("fs")
const [numTestCases, ...btnsPressedsList] = readFileSync("/dev/stdin", "utf8").split("\n")


const SystemOfADownloadMusicsList = Object.freeze(
	new Map([
		[0, "PROXYCITY"],
		[1, "P.Y.N.G."],
		[2, "DNSUEY!"],
		[3, "SERVERS"],
		[4, "HOST!"],
		[5, "CRIPTONIZE"],
		[6, "OFFLINE DAY"],
		[7, "SALT"],
		[8, "ANSWER!"],
		[9, "RAR?"],
		[10, "WIFI ANTENNAS"]
	])
)


function main() {
	const responses = []

	const btnsPressedsValues = btnsPressedsList.slice(0, +numTestCases).map(
		btnsPresseds => btnsPresseds
			.split(" ")
			.map(num => Number.parseInt(num, 10))
	)

	btnsPressedsValues.forEach(([firstBTNValue, secondBTNValue = 0]) => {
		responses.push(
			SystemOfADownloadMusicsList.get(firstBTNValue + secondBTNValue)
		)
	})

	console.log(responses.join("\n"))
}

main()
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 3 4 0 0 1 0

Output

x
+
cmd
SALT PROXYCITY P.Y.N.G.

#5 Code Example with Python Programming

Code - Python Programming


song = ['PROXYCITY','P.Y.N.G.','DNSUEY!','SERVERS','HOST!','CRIPTONIZE','OFFLINE DAY', 'SALT','ANSWER!','RAR?','WIFI ANTENNAS']
n = int(input())
while(n>0):
    n -= 1
    x, y = input().split()
    print(song[int(x)+int(y)])
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 3 4 0 0 1 0

Output

x
+
cmd
SALT PROXYCITY P.Y.N.G.

Demonstration


Previous
#2581 Beecrowd Online Judge Solution 2581 I am Toorg! Solution in C, C++, Java, Js and Python
Next
#2590 Beecrowd Online Judge Solution 2590 Seven Solution in C, C++, Java, Js and Python