Question: 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 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 or q should be replaced by the text OUT and any integer whose decimal representation contains digit p or 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. programe in C++ langauge
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
