Prime Sum PRIMESM Codechef Solution

Prime Sum PRIMESM Codechef Solution

Prime Sum PRIMESM Codechef Solution Given two integers A and B. Let P denote a sequence of N prime numbers such that the sum of the sequence is A. Let Q denote a sequence of M prime numbers such that the sum of the sequence is B. Let X denote the maximum absolute difference between … Read more

Pairwise Xors XORABC Codechef Solution

Pairwise Xors XORABC Codechef Solution JJ gives Chef a number X and challenges Chef to come up with three distinct numbers A, B, and C such that: 0≤A,B,C<230; (A⊕B)+(B⊕C)+(C⊕A)=X. Help Chef come up with three such numbers or determine that no such tuple exists. Here, ⊕ denotes the bitwise XOR operation. Input Format Output Format … Read more

Dazzling AXNODR Challenge AXNODR Codechef Solution

Dazzling AXNODR Challenge AXNODR

Dazzling AXNODR Challenge AXNODR Solution Dazzler has a blank canvas and (N−1) colours numbered from 2 to N. Let B denote the beauty of the canvas. The beauty of a blank canvas is 1. Dazzler paints the canvas by using all the (N−1) colours exactly once. On applying the ith colour (2≤i≤N): If i is … Read more

Dazzling GCD Pair NOTUNIT Solution

Dazzling GCD Pair NOTUNIT

Dazzling GCD Pair NOTUNIT Solution Dazzler has a task for you. Given two positive integers A and B, find two positive integers i and j such that: If there are multiple solutions, you may print any of them. If no such pair exists, print −1. Input Format Output Format For each test case, output in … Read more

The Cooler Dilemma 2 WATERCOOLER2 Solution

The Cooler Dilemma 2 WATERCOOLER2

The Cooler Dilemma 2 WATERCOOLER2 Solution The summer is at its peak in Chefland. Chef is planning to purchase a water cooler to keep his room cool. He has two options available: Rent a cooler at the cost of X coins per month. Purchase a cooler for Y coins. Chef wonders what is the maximum number … Read more