Mutated Minions: CHN15A

Mutated Minions Codechef Solution

CU Submission link

Public Submission link

Gru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions’ incapability which has kept him away from the limelight, he has built a transmogrifier — a machine which mutates minions.

Each minion has an intrinsic characteristic value (similar to our DNA), which is an integer. The transmogrifier adds an integer K to each of the minions’ characteristic value.

Gru knows that if the new characteristic value of a minion is divisible by 7, then it will have Wolverine-like mutations.

Mutated Minions Codechef Solution

Given the initial characteristic integers of N minions, all of which are then transmogrified, find out how many of them become Wolverine-like.

Input Format:

The first line contains one integer, T, which is the number of test cases. Each test case is then described in two lines.

The first line contains two integers N and K, as described in the statement.

The next line contains N integers, which denote the initial characteristic values for the minions.

Output Format:

For each testcase, output one integer in a new line, which is the number of Wolverine-like minions after the transmogrification.


  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 100
  • 1 ≤ K ≤ 100
  • All initial characteristic values lie between 1 and 105, both inclusive.


5 10
2 4 1 35 1



After transmogrification, the characteristic values become {12,14,11,45,11}, out of which only 14 is divisible by 7. So only the second minion becomes Wolverine-like.

Mutated Minions Codechef Solution in JAVA

/* package codechef; // don't place package name! */

import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
    static Scanner any = new Scanner(;
    public static void findMinions (int numOfTest) {
        while (numOfTest > 0)   {
            int araSize = any.nextInt();
            int increment = any.nextInt();
            int[] ara = new int[araSize];
            for (int i=0; i< araSize; i++)   {
                ara[i] = any.nextInt();
                ara[i] += increment;

            increment = 0;
            for (int temp : ara)    {
                if (temp % 7 == 0)
            System.out.println (increment);
	public static void main (String[] args) throws java.lang.Exception
		int numOfTest = any.nextInt();

Mutated Minions Codechef Solution in C++

void solve_test()
    int n, k, current;
    cin >> n >> k; 
    int arr[n];
    int i;
    for (i = 0; i < n; i++)    cin >> arr[i];
    int result = 0;
    for (i = 0; i < n; i++)
        current = arr[i] + k;
        if (current % 7 == 0)
    cout << result << endl;

int main() {
    int t;
    cin >> t;
    while (t--)
    return 0;

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.

This is Mutated Minions Codechef Solution

Click here for more CodeChef problems and solutions

Recently added progies

More from PROGIEZ