0% found this document useful (0 votes)
68 views4 pages

Skillrack Points Tracker Guide

Here is a Python program to solve the problem: ```python import sys expression, remainder_modulus = map(int, sys.stdin.readline().split()) remainder, modulus = map(int, sys.stdin.readline().split()) for x in range(modulus): eval_expression = eval(expression) if eval_expression % modulus == remainder: print(x) break ``` This program: 1. Reads the arithmetic expression and remainder/modulus as input 2. Loops from 0 to modulus-1 to find the smallest value of x 3. Evaluates the expression for each x value 4. Checks if the remainder of expression
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

Skillrack Points Tracker Guide

Here is a Python program to solve the problem: ```python import sys expression, remainder_modulus = map(int, sys.stdin.readline().split()) remainder, modulus = map(int, sys.stdin.readline().split()) for x in range(modulus): eval_expression = eval(expression) if eval_expression % modulus == remainder: print(x) break ``` This program: 1. Reads the arithmetic expression and remainder/modulus as input 2. Loops from 0 to modulus-1 to find the smallest value of x 3. Evaluates the expression for each x value 4. Checks if the remainder of expression
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

INTEL (IIT Kharagpur Placement, 2022)

Tuesday, October 11, 2022 11:13 PM

How many pairs of letters are there in the word ‘POSTMASTER’ which has
as many letters between them (from both sides) in the word as in the
alphabets from A to Z?

A container has three liquids A, B and C in the volume ratio 2 : 3 : 4. The


volume of the container is 90 L. 30 L of the solution is taken out and then
replaced with liquid A. 45 L of the solution so formed is taken out and is
then replaced with liquid C. Find the ratio of the volumes so formed finally.

Santhosh and Sameer are running around a circular track of diameter 280
metres. Santhosh can go round the track once in 110 seconds and Sameer is
faster than Santhosh by 50%. They started simultaneously towards each
other starting from two diametrically opposite points A and B. If D is the
point between A and B at which they meet for the first time, after how
much time from the start do they meet at D for the fifth time?

QUESTION: 36GROUP: CodingSECTION: Language Coding 1


Mark(s): 10
Jerome is an IT professional engineer. He has an old model configured chip in his
house, which is not supported in his new laptop. He wants to re-configure it so that it
can be used. To re-configure it, he has done many experiments. At last, finally he got a
solution. The solution is, in the old chip there are two codes(numbers) written on it X
and Y. He has to replace X with a new reconfigured code M. M must be the least
number that must include X as the leading digits and it is a multiple of Y
Can you help Jerome with a program that accepts X and Y and prints new reconfigured
code M of the chip.

Read the input from STDIN and print the output to STDOUT. Do not write arbitrary
strings anywhere in the program, as these contribute to the standard output and test
cases will fail.

Constraints:
i. X, Y >= 1

Input Format:
The input contains two codes X and Y of the old chip separated by a single white
space.

Output Format:
The output must consist of new reconfigured code M of the chip.

Sample Input 1:
33 11

Sample Output 1:
33

Explanation 1:
Old chip two codes, X and Y: 33 and 11.
Here, by the following method of re-configuration, possibilities can be M: 33, 330, 331,
332, and so on.
Here, considering M = 33, its leading digit(s) is X (33) and it is a multiple of Y(11).
Hence, 33 is the new reconfigured code of the chip.

Sample Input 2:
50 3

Sample Output 2:
501

Explanation 2:
Old chip two codes, X and Y: 50 and 3
Here, by the following method of re-configuration, possibilities can be M: 50, 500, 501,
502, and so on.
Here, considering M = 501,its leading digit(s) are X(50) and is also multiple of Y(3).
Hence, 501 is the new reconfigured code of the chip.

QUESTION: 37GROUP: CodingSECTION: Language Coding 2


Mark(s): 10

Bob is a studious boy. He is very interested in solving difficult mathematical problems


in no time. By seeing his talent, Bob's teacher gave him a problem and asked him to
solve it as soon as possible.

The problem was, Bob has been given an arithmetic expression A, the integer P,
and M and he has to find the smallest non-negative value of x in expression A such that
the remainder of dividing A by M equals P. Consider that solution do exist for the
problems provided to him.

Therefore, if the principles of distribution are applied to expression A (Formally, the


expression A is a polynomial of the first degree in variable x).

Can you help Bob with a program to solve the problem in a minimum amount of time.

Input Format:
The first line of input contains the expression A.
The second line of input contains two integers P i M.
The arithmetic expression A will only consist of characters , -, *, (, ), x, and digits from 0
to 9. The brackets will always be paired, the operators , - and * will always be applied to
exactly two values (there will not be an expression (-5) or (4 -5)) and all multiplications
will be explicit (there will not be an expression 4(5) or 2(x)).

Output Format:
The first and only line of output must contain the smallest non-negative value of
variable x.

Constraints:
i. A (1 ≤ |A| ≤ 105)
ii. P (0 ≤ P ≤ M − 1) i M (1 ≤ M ≤ 106)

Sample Input 1:
4+x+2
89

Sample Output 1:
2

Explanation 1:
Arithmetic expression, A: 4+x+2
P: 8 M: 9
Here, by solving the given equation, we will get:
If x = 0, then the remainder of dividing 4 x 2 with 9 is 6, which is not equal to P.
If x = 1, then the remainder of division 4 x 2 with 9 is 7, which is not equal to P.
If x = 2, then the remainder of division 4 x 2 with 9 is 8, which is equal to P.
Hence, as an output, it will print 2 as the smallest value of variable x.

Sample Input 2:
2*(x+(x+3)*9)
26

Sample Output 2:
1

Explanation 2:
Arithmetic expression, A: 2*(x+(x+3)*9)
P: 2 M: 6
Here, by solving the given equation, we will get:
If x = 0, then the remainder of dividing 2 * ( x+( x+3 ) * 9 ) with 6 is 0, which is not
equal to P.
If x = 1, then the remainder of division 2 * ( x+(x+3) * 9 ) with 6 is 2, which is equal
to P.
Hence, as an output, it will print 1 as the smallest value of variable x.

You might also like