Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions