Algorithm


Problem Name: 2 AD-HOC - beecrowd | 1546

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

Feedback

 

By Jean Bez, URI BR Brazil

Timelimit: 1

Several students from various universities know the programming portal IRU. This portal has thousands of programming problems available. Daily, the IRU team receives several feedback (compliments, bugs, questions, suggestions, ...) that must first be assigned to team members answer.

As the team is very busy and have no time to sort these feedbacks, you were asked to write a program to do that and show who will be responsible for resolving and responding the feedback.

The team members responsible for each sector are:

  1. Compliments: Rolien
  2. Bugs: Naej
  3. Questions: Elehcim
  4. Suggestions: Odranoel

 

Input

 

The first value is the number of test cases N (1 < N < 100). Each test case represent a day of work responding feedbacks. Each test case starts with K (1 < K < 50), indicating the number of feedbacks received on that date. Then follows K lines with and integer representing the category of each of the feedbacks as shown above (1, 2, 3 or 4).

 

Output

 

For each test case you must print the name of the team member responsible for the feedback.

 

 

 

Sample Input Sample Output

2
4
1
1
3
4
3
3
3
2

Rolien
Rolien
Elehcim
Odranoel
Elehcim
Elehcim
Naej

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main(void) {
    int q, p, r, s, n;

    scanf("%d", &q);
    for (p = 0; p  <  q; ++p) {
        scanf("%d", &r);
        for (s = 0; s  <  r; ++s) {
            scanf("%d", &n);
            switch (n) {
                case 1: printf("Rolien\n");   break;
                case 2: printf("Naej\n");     break;
                case 3: printf("Elehcim\n");  break;
                case 4: printf("Odranoel\n"); break;
            }
        }
    }
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
2
4
1
1
3
4
3
3
3
2

Output

x
+
cmd
Rolien
Rolien
Elehcim
Odranoel
Elehcim
Elehcim
Naej

#2 Code Example with C++ Programming

Code - C++ Programming


#include <iostream>

using namespace std;

int main(void) {
    int q, p, r, s, n;

    cin >> q;
    for (p = 0; p  <  q; ++p) {
        cin >> r;
        for (s = 0; s  <  r; ++s) {
            cin >> n;
            switch (n) {
                case 1: cout << "Rolien";   break;
                case 2: cout << "Naej";     break;
                case 3: cout << "Elehcim";  break;
                case 4: cout << "Odranoel"; break;
            }
            cout << endl;
        }
    }
    return 0;
}

Copy The Code & Try With Live Editor

Input

x
+
cmd
2
4
1
1
3
4
3
3
3
2

Output

x
+
cmd
Rolien
Rolien
Elehcim
Odranoel
Elehcim
Elehcim
Naej

#3 Code Example with Java Programming

Code - Java Programming


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
   static Reader in = new Reader(System.in);
    static Writer out = new Writer(System.out);
    static final String[] SECTORS = {"Rolien", "Naej", "Elehcim", "Odranoel"};

    public static void main(String[] args) throws IOException {
        int N = in.nextInt(), K;
        while (N-- > 0) {
            K = in.nextInt();
            while (K-- > 0) {
                out.println(SECTORS[in.nextInt() - 1]);
            }
        }
        in.close();
        out.flush();
        out.close();
    }

    ///////////  INPUT / OUTPUT  //////////////
    static class Reader implements Closeable {

        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public Reader(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        private StringTokenizer getTokenizer() throws IOException {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) {
                    return null;
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer;
        }

        public boolean hasNext() throws IOException {
            return getTokenizer() != null;
        }

        public String next() throws IOException {
            return hasNext() ? tokenizer.nextToken() : null;
        }

        public String nextLine() throws IOException {
            tokenizer = null;
            return reader.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public float nextFloat() throws IOException {
            return Float.parseFloat(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public String[] nextStringArray(int size) throws IOException {
            String[] array = new String[size];
            for (int i = 0; i  <  size; i++) {
                array[i] = next();
            }
            return array;
        }

        public int[] nextIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i  <  size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        public long[] nextLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i  <  size; i++) {
                array[i] = nextLong();
            }
            return array;
        }

        public double[] nextDoubleArray(int size) throws IOException {
            double[] array = new double[size];
            for (int i = 0; i  <  size; i++) {
                array[i] = nextDouble();
            }
            return array;
        }

        @Override
        public void close() throws IOException {
            tokenizer = null;
            reader.close();
        }
    }

    static class Writer {

        private final PrintWriter writer;

        public Writer(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public void print(Object... objects) {
            for (int i = 0; i  <  objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

    }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
2
4
1
1
3
4
3
3
3
2

Output

x
+
cmd
Rolien
Rolien
Elehcim
Odranoel
Elehcim
Elehcim
Naej

#4 Code Example with Javascript Programming

Code - Javascript Programming


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

const FeedbackTypeCode = {
	1: "Elogios",
	2: "Bugs",
	3: "Duvidas",
	4: "Sugestoes"
}

const FeedbackTypeMember = {
	Elogios: "Rolien",
	Bugs: "Naej",
	Duvidas: "Elehcim",
	Sugestoes: "Odranoel"
}

function main() {
	const responses = []

	let j = +numLines
	let i = 0

	while (j--) {
		let numFeedbacks = +lines[i++]

		while (numFeedbacks--) {
			const code = lines[i++]
			const type = FeedbackTypeCode[code]
			const memberName = FeedbackTypeMember[type]

			responses.push(memberName)
		}
	}

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

main()
Copy The Code & Try With Live Editor

Input

x
+
cmd
2
4
1
1
3
4
3
3
3
2

Output

x
+
cmd
Rolien
Rolien
Elehcim
Odranoel
Elehcim
Elehcim
Naej

#5 Code Example with Python Programming

Code - Python Programming


q = int(input())
for p in range(q):
    r = int(input())
    for s in range(r):
        n = int(input())
        if n == 1: print('Rolien')
        elif n == 2: print('Naej')
        elif n == 3: print('Elehcim')
        else: print('Odranoel')

Copy The Code & Try With Live Editor

Input

x
+
cmd
2
4
1
1
3
4
3
3
3
2

Output

x
+
cmd
Rolien
Rolien
Elehcim
Odranoel
Elehcim
Elehcim
Naej
Advertisements

Demonstration


Previous
#1542 Beecrowd Online Judge Solution 1542 Reading Books Solution in C, C++, Java, Js and Python
Next
#1547 Beecrowd Online Judge Solution 1547 Guess What Solution in C, C++, Java, Js and Python