## Interesting Pairs solution codechef

Interesting Pairs solution codechef Given an array AA having NN elements, Chef wonders how many pairs (i,j)(i,j) exists such that 1≤i<j≤N1≤i<j≤N, and Ai⋅AjAi⋅Aj is divisible by i⋅ji⋅j. Can you help Chef in finding the number of such pairs? Input Format Interesting Pairs solution codechef The first line of input contains a single integer TT, denoting the number of test cases. The description of the TT testcases follows. The … Read more

## Make that Array! solution codechef

Make that Array! solution codechef Chef is given two arrays A and B, each having N elements. In one move, Chef can choose an index i (1≤i≤N−1), get (Ai−Ai+1) points, and then swap Ai and Ai+1. For example: If Chef has the array – [10,7,5] and Chef chooses index 1 during his move, he will get 10−7=3 points and the new array will become [7,10,5] Can you help Chef in finding the maximum number of … Read more

## Add and Divide solution codechef

Add and Divide solution codechef You are given two positive integers aa and bb. You also have a number xx, which is initially set to 00. At first, you can add aa to xx any number of times. After that, you can divide xx by bb any number of times as long as xx is divisible by bb. Print YES if you can make xx equal to 11, otherwise print NO. Input Format First line of input … Read more

## Magical Doors solution codechef

Magical Doors solution codechef Chef wants to cross a hallway of NN doors. These NN doors are represented as a string. Each door is initially either open or close, represented by 11 or 00 respectively. Chef is required to go through all the doors one by one in the order that they appear, starting from the leftmost door and moving only rightwards at … Read more

## Maximum Light Up solution codechef

Maximum Light Up solution codechef   Chef has allocated himself a budget of PP rupees to buy Diwali crackers. There are only 33 types of crackers available in the market and each type of cracker can be bought any number of times. Fuljhari, where each costs aa rupees Anar, where each costs bb rupees Chakri, where each costs cc rupees The crackers have the following … Read more

## Chef in Vaccination Queue solution codechef

Chef in Vaccination Queue solution codechef There are NN people in the vaccination queue, Chef is standing on the PthPth position from the front of the queue. It takes XX minutes to vaccinate a child and YY minutes to vaccinate an elderly person. Assume Chef is an elderly person. You are given a binary array A1,A2,…,ANA1,A2,…,AN of length NN, where Ai=1Ai=1 denotes there is an elderly person standing … Read more

## The Preparations solution codechef

The Preparations solution codechef   Chef has an exam which will start exactly MM minutes from now. However, instead of preparing for his exam, Chef started watching Season-11 of Superchef. Season-11 has NN episodes, and the duration of each episode is KK minutes. Will Chef be able to finish watching Season-11 strictly before the exam starts? Note:Note: Please read the explanations of the sample test cases carefully. Input … Read more

## Interesting Representation solution codechef

Interesting Representation solution codechef Given a positive integer NN, find two positive integers AA and BB, such that A−B=NA−B=N and the number of distinct prime factors of AA and BB are equal. If there exist multiple pairs of values of AA and BB satisfying the given conditions, you can output any one of them. First line will contain TT, number of testcases. Then the testcases follow. Each testcase contains of a single … Read more

## Alice vs Bob Faceoff solution codechef

Alice vs Bob Faceoff solution codechef Alice and Bob have got an integer NN. They decide to play a game. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. The game continues until NN becomes 00. The player who is unable to make a … Read more

## Yet another SOD problem solution codechef

Yet another SOD problem solution codechef Ujan is a software developer. He is developing a software that takes two integers LL and RR and outputs the count of integers in the sequence L,L+1,…,R−1,RL,L+1,…,R−1,R whose sum of digits (SOD) is divisible by 33. He has developed the user interface (UI) quite easily. He is having a hard time finding the logic to solve … Read more