Chef and planes
All submissions for this problem are available.
Chef is a great fan of air crash investigation and seeing the mistakes of air traffic controller decides to take this responsibility. Chef will instruct the planes during the initial phase of flight from BYTELAND AIRPORT for certain amount of time (t). The initial altitude of plane for t time is given. At each time instant chef will instruct the planes according to two control instructions a and b to help pilots fly the plane which will apply for all the remaining time of the flight. a will tell us about the operation to be applied and b will give the magnitude of the operation.
For instruction at ith time instant will be applied to all altitudes for time >= i and <= t.
a can be either 1 or 2 and the corresponding operations are given below.
1. Multiply the altitude by a factor, quick and adventurous isn`t it :P.
2. Add a certain altitude.
You job is to print the altitude during the flight of the plane at given instant i <= t.
- The first line of the input contains an integer n denoting the number of test cases. The description of n test cases follows.
- Each test case contains t (time for which to instruct) followed by initial altitudes for t secs. Following this will be operation for each of the t secs.
(look at examples for details).
- For each test case, print the altitude modulo 10000 during the flight of the plane at given instant i <= t..
- 1 ≤ n ≤ 1000
- 1 ≤ t ≤ 10000
- Initial altitude have a value less than 1011.
- you can safely assume that both inputs (a and b) of the control operation will be accommodated in int.
Input: 1 3 12 14 15 1 2 2 2 2 2 Output: 24 30 34
Example case 1.
After 1st sec : 24 28 30 (at t = 1 sec you need to print 1st altitude at that instant)
After 2nd sec : 24 30 32
After 3rd sec : 24 32 34
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.