Algorithm


Problem Name: beecrowd | 2626

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

JB6 Team

 

By Matheus Pimenta, UNB BR Brazil

Timelimit: 1

Dodô, Leo e Pepper often spend the early hours of the morning chatting somewhere in the condominium Jardim Botânico IV. In the last few sessions, Dodo has been talking about the RPG game he and Leo are creating, and Leo (not surprisingly) has spoken about heavy metal and Pepper was fascinated by the story of Greek mythology told by Leo.

The boys decided to adopt a strategy to divide the sessions equally among the subjects, só each one to them can speculate as much as possible and arrive at unbilievable conclusions. They wall play “rock, paper and scissors” to decide the subject of today’s session, and then they will alternate the subjects in the next sessions. Given the moves of Dodo, Leo and Pepper, in this order, you must determine the subject of today’s session.

 

Input

 

The input is composed of several test cases and ends with end of file (EOF). Each test case consists of a single line, which contains the plays of each of the boys, as shown in the exemples.

 

Output

 

For each test case, print a single line with the message "Os atributos dos monstros vao ser inteligencia, sabedoria…" to indicate that Dodo is the winner, the message "Iron Maiden's gonna get you, no matter how far!" to indicate that Leo is the winner, the message "Urano perdeu algo muito precioso…" to indicate that Pepper is the winner, of the message "Putz vei, o Leo ta demorando muito pra jogar…" if there is a tie.

 

 

 

Input Sample Output Sample

papel pedra pedra

papel tesoura papel

pedra pedra papel

papel papel pedra

Os atributos dos monstros vao ser inteligencia, sabedoria...

Iron Maiden's gonna get you, no matter how far!

Urano perdeu algo muito precioso...

Putz vei, o Leo ta demorando muito pra jogar...

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>
#include <string.h>

int main(void)

{
    int a, b, i, j;
    char s1[10], s2[10], s3[10];

    while (scanf("%s %s %s", s1, s2, s3) != EOF)
    {
        if (strcmp(s1, "papel")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "papel")==0)
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "pedra")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "tesoura")==0))
            printf("Urano perdeu algo muito precioso...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "papel")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "pedra")==0))
            printf("Os atributos dos monstros vao ser inteligencia, sabedoria...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "tesoura")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "papel")==0))
            printf("Iron Maiden's gonna get you, no matter how far!\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "pedra")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "papel")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "tesoura")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");



        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "papel")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "pedra")==0))
            printf("Iron Maiden's gonna get you, no matter how far!\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "tesoura")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "papel")==0))
            printf("Urano perdeu algo muito precioso...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "pedra")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "tesoura")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "papel")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "pedra")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "pedra")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "tesoura")==0))
            printf("Os atributos dos monstros vao ser inteligencia, sabedoria...\n");



        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "papel")==0))
            printf("Os atributos dos monstros vao ser inteligencia, sabedoria...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "pedra")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "papel")==0 && strcmp(s3, "tesoura")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "papel")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "pedra")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "pedra")==0 && strcmp(s3, "tesoura")==0))
            printf("Iron Maiden's gonna get you, no matter how far!\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "papel")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "pedra")==0))
            printf("Urano perdeu algo muito precioso...\n");

        if ((strcmp(s1, "tesoura")==0 && strcmp(s2, "tesoura")==0 && strcmp(s3, "tesoura")==0))
            printf("Putz vei, o Leo ta demorando muito pra jogar...\n");
    }

    return 0;
}

Copy The Code & Try With Live Editor

Input

x
+
cmd
papel pedra pedra papel tesoura papel pedra pedra papel papel papel pedra

Output

x
+
cmd
Os atributos dos monstros vao ser inteligencia, sabedoria... Iron Maiden's gonna get you, no matter how far! Urano perdeu algo muito precioso... Putz vei, o Leo ta demorando muito pra jogar...

#2 Code Example with Java Programming

Code - Java Programming


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String venceDodo   = "Os atributos dos monstros vao ser inteligencia, sabedoria...";
		String venceLeo    = "Iron Maiden's gonna get you, no matter how far!";
		String vencePepper = "Urano perdeu algo muito precioso...";
		String venceEmpate = "Putz vei, o Leo ta demorando muito pra jogar...";
		while(sc.hasNext()) {
			String dodo = sc.next();
			String leo = sc.next();
			String pepper = sc.next();
					 if(dodo.equals("papel") && leo.equals("papel") && pepper.equals("tesoura")) System.out.println(vencePepper);
				else if(dodo.equals("papel") && leo.equals("pedra") && pepper.equals("pedra")) System.out.println(venceDodo);
				else if(dodo.equals("papel") && leo.equals("tesoura") && pepper.equals("papel")) System.out.println(venceLeo);
				else if(dodo.equals("pedra") && leo.equals("papel") && pepper.equals("pedra")) System.out.println(venceLeo);
				else if(dodo.equals("pedra") && leo.equals("pedra") && pepper.equals("papel")) System.out.println(vencePepper);
				else if(dodo.equals("pedra") && leo.equals("tesoura") && pepper.equals("tesoura")) System.out.println(venceDodo);
				else if(dodo.equals("tesoura") && leo.equals("papel") && pepper.equals("papel")) System.out.println(venceDodo);
				else if(dodo.equals("tesoura") && leo.equals("pedra") && pepper.equals("tesoura")) System.out.println(venceLeo);
				else if(dodo.equals("tesoura") && leo.equals("tesoura") && pepper.equals("pedra")) System.out.println(vencePepper);
				else System.out.println(venceEmpate);
		}
		sc.close();
	}
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
papel pedra pedra papel tesoura papel pedra pedra papel papel papel pedra

Output

x
+
cmd
Os atributos dos monstros vao ser inteligencia, sabedoria... Iron Maiden's gonna get you, no matter how far! Urano perdeu algo muito precioso... Putz vei, o Leo ta demorando muito pra jogar...

#3 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var prompt = function(texto) { return lines.shift();};


const dodo = [
  "papel pedra pedra",
  "pedra tesoura tesoura",
  "tesoura papel papel",
];
const leo = [
  "pedra papel pedra",
  "tesoura pedra tesoura",
  "papel tesoura papel",
];
const pepper = [
  "pedra pedra papel",
  "tesoura tesoura pedra",
  "papel papel tesoura",
];

while (true) {
  var game = prompt();
  if (game == "") {
    break;
  }

  if (dodo.includes(game)) {
    console.log("Os atributos dos monstros vao ser inteligencia, sabedoria...");
  } else if (leo.includes(game)) {
    console.log("Iron Maiden's gonna get you, no matter how far!");
  } else if (pepper.includes(game)) {
    console.log("Urano perdeu algo muito precioso...");
  } else {
    console.log("Putz vei, o Leo ta demorando muito pra jogar...");
  }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
papel pedra pedra papel tesoura papel pedra pedra papel papel papel pedra

Output

x
+
cmd
Os atributos dos monstros vao ser inteligencia, sabedoria... Iron Maiden's gonna get you, no matter how far! Urano perdeu algo muito precioso... Putz vei, o Leo ta demorando muito pra jogar...
Advertisements

Demonstration


Previous
#2600 Beecrowd Online Judge Solution 2600 Tustin and His New Die Solution in C, C++, Java, Js and Python
Next
#2630 Beecrowd Online Judge Solution 2630 Greyscale Solution in C, C++, Java, Js and Python