Athenaeus has recently wrapped up making his most recent melodic piece and will introduce it tomorrow to individuals of Athens. Tragically, the tune is somewhat dull and almost certain will not be met with a warm gathering.    His tune comprises of n notes, which we will treat as certain integers. The variety of a tune

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

Athenaeus has recently wrapped up making his most recent melodic piece and will introduce it tomorrow to individuals of Athens. Tragically, the tune is somewhat dull and almost certain will not be met with a warm gathering. 

 

His tune comprises of n notes, which we will treat as certain integers. The variety of a tune is the number of various notes it contains. As a supporter of music, Euterpe looks after arrangers and guides them all through the method involved with making new tunes. She chose to help Athenaeus by changing his melody to make it more assorted. 

 

Being a minor goddess, she can't self-assertively change the tune. All things being equal, for every one of the n notes in the tune, she can either leave it for what it's worth or increment it by 1. 

 

Given the tune as an arrangement of integers portraying the notes, discover the maximal, attainable variety. 

 

Input 

 

The input comprises of numerous experiments. The principal line contains an integer t (1≤t≤10000) — the number of experiments. Then, at that point, t experiments follow, every one is portrayed in two lines. 

 

In the principal line of each experiment there is a solitary integer n (1≤n≤105) meaning the length of the melody. The following line contains an arrangement of n integers x1,x2,… ,xn (1≤x1≤x2≤… ≤xn≤2⋅n), portraying the melody. 

 

The amount of n over all experiments doesn't surpass 105. 

 

Output 

 

For each experiment, you should output a solitary line containing exactly one integer, the maximal variety of the melody, for example the maximal conceivable number of various components in the last succession.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education