Pinocchio and Lampwick - Part 1
All submissions for this problem are available.
Pinocchio is a very interesting fictional character. Each time he lies, his nose is extended by 1 cm .
Pinocchio and Lampwick are best friends.
But Pinocchio's habit of lying has increased manyfold nowadays which has left Lampwick really upset. As a result, he has decided to maintain a diary recording the length of Pinocchio's nose each day. For this, he asks Pinocchio some questions each day and notes down the length of his nose in centimeters at the end of the day.
For example, the diary containing entries for a week may look like: 1, 2, 2, 3, 4, 5, 5
After N days of carefully analysing Pinocchio's lying habit, Lampwick wants to confront Pinocchio. But for that he needs to find out the number of days when Pinocchio lied atleast once. Can you help him out?
Being a trusting friend, Lampwick assumes Pinocchio was telling the truth on the first day.
First line of input contains T, the number of test cases.
For each of the next T lines, two lines follow. The first line contains an integer N, denoting the number of days. The second line contains N space-separated integers L1, L2, ..., LN representing the length of Pinocchio's nose on different days.
For each test case, output the number of days when Pinocchio lied atleast once , in a new line
- 1 <= T <= 100
- 1 <= N <= 105
- 1 <= Li <= 5*106
1 7 1 2 2 3 4 5 5Output:
For the example given above, Pinocchio lied on days 2, 4, 5 and 6 .Hence, the number of days on which he lied = 4.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, 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, SCM chicken, CLOJ, FS|
Fetching successful submissions