Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program that incorporates both the bMoney class from Exercise 8 and the sterling


class from Exercise 11. Write conversion operators to convert between bMoney and


sterling, assuming that one pound (£1.0.0) equals fifty dollars ($50.00). This was the


approximate exchange rate in the 19th century when the British Empire was at its height


and the pounds-shillings-pence format was in use. Write a main() program that allows


the user to enter an amount in either currency and then converts it to the other currency


and displays the result. Minimize any modifications to the existing bMoney and sterling


classes.

You are given an undirected tree with N nodes and the tree is rooted at node 1. Each node has an integer value A[i] associated with it represented by an array A of size N.


Also, you are given Q queries of the following type:


• uvk: Find the kth smallest value present on the simple path between node u and node v. If the number of nodes on the simple path between node u and node v is less than k, then print —1.


Input format

•  The first line contains two space-separated integers NQ denoting the number of nodes and queries respectively.

•  The second line contains N space-separated integers denoting array A.

•  Next N — 1 line contains two space-separated integers denoting the edges of the tree.

•  Next Q lines contain three space-separated integers denoting the queries.


Output format

Print Q space-separated integers denoting the answer of queries.


Constraints


1 ≤ N ≤ 4 x 104

1 ≤ Q ≤ 105

1 ≤ A[i] ≤ 109

Any number is called beautiful if it consists of 2N digits and the sum of the first N digits is equal to the sum of the last N digits. Your task is to find the count of beautiful numbers in the interval from L to R (including L and R).


Beautiful numbers do not have leading zeroes.


Input format


•  The first line contains an integer T denoting the number of test cases.

•  The first line of each test case contains two space-separated integers L and R denoting the range interval [L, R].


Output format


For each test case, print the count of beautiful numbers in a new line.


Constraints


1 T ≤ 2000001 ≤ L ≤ R ≤ 100000000
  SAMPLE INPUT                  SAMPLE OUTPUT

     1                                                                                            9

1 100

Write code using binary sort that


Finds the total number of boys and girls in class.

An electricity board charges the following rates to domestic users to

discourage large consumption of energy.


 For the first 100 units − 50 P per unit


 Beyond 100 units − 60 P per unit


If the total cost is more than Rs.250.00 then an additional surcharge of

15% is added on the difference. Define a class Electricity in which the

function Bill computes the cost. Define a derived class More_Electricity

and override Bill to add the surcharge.



sorting 5 numbers using the basics (without array)


Show the output of the following code :

double area = 5.2 ;

cout << "area " ;

cout << area ;


An electricity board charges the following rates to domestic users to

discourage large consumption of energy.


 For the first 100 units − 50 P per unit


 Beyond 100 units − 60 P per unit


If the total cost is more than Rs.250.00 then an additional surcharge of

15% is added on the difference. Define a class Electricity in which the

function Bill computes the cost. Define a derived class More_Electricity

and override Bill to add the surcharge.


Write a program that declares two classes. The parent class is called Simple that has

two data members num1 and num2 to store two numbers. It also has four member

functions.


 The add() function adds two numbers and displays the result.

 The sub() function subtracts two numbers and displays the result.

 The mul() function multiplies two numbers and displays the result.

 The div() function divides two numbers and displays the result.

The child class is called Complex that overrides all four functions. Each function in

the child class checks the value of data members. It calls the corresponding member

function in the parent class if the values are greater than 0. Otherwise it displays

error message.


Write a program having a base class Student with data members

rollno, name and Class

define a member functions getdata() to input values and another

function putdata() to display all values. A class Test is derived from class

Student with data members T1marks, T2marks, T3marks, Sessional1,

Sessional2, Assignment and Final. Also make a function getmarks() to

enter marks for all variables except Final and also make a function

putmarks() to display result. Make a function Finalresult() to calculate

value for final variable using other marks. Then display the student

result along with student data.


LATEST TUTORIALS
APPROVED BY CLIENTS