Company: Texas

Difficulty: easy

Problem Statement

Reference Level Queries A device is configured with two integers, `base` and `ratio`. The sum `base + ratio` is called the device's reference level . You must answer `q` independent queries. Each query has one of these three forms: `D` — report the reference level itself. `I x` — report the reference level reduced by the offset `x`, that is `base + ratio - x`. `S x` — report the reference level reduced by the offset `x`, that is `base + ratio - x`. A `D` query behaves exactly like an `I` or `S` query with an offset of `0`, and `I` and `S` apply their offset in the same way. An offset may be negative, in which case the reported value is larger than the reference level. Input Format The first line contains two space-separated integers `base` and `ratio`. The second line contains the integer `q`. Each of the next `q` lines contains one query, written as `D`, or as `I x`, or as `S x`. Output Format For each query, print the reported value on its own line, in the order the

More Texas OA questionsInterview experiences