Question: in c++ you will be given a positive integer N, and two single-digit integers p and q, where p != q and both are greater

in c++

you will be given a positive integer N, and two single-digit integers p and q, where p != q and both are greater than 1. You must output all of the integers from 1 to N inclusive, separated by a comma,

However, any integer divisible by p should be replaced by the text OUT and any integer whose decimal representation contains digit q should be replaced by the text THINK. Integers for which both of the preceding statements are true should instead be replaced by the text OUTTHINK.

Input:

A single line on standard input per test case: N p q

Output:

The comma-separated sequence as described above (only numbers and uppercase chars), with no leading or trailing spaces.

Test 1

Test Input

Download Test Input

25 4 2 

Expected Output

Download Test Output

1,THINK,3,OUT,5,6,7,OUT,9,10,11,OUTTHINK,13,14,15,OUT,17,18,19,OUTTHINK,THINK,THINK,THINK,OUTTHINK,THINK 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!