add two polynomials given two polynomials a and b, write a program that adds the given two polynomials a and b. input the first line contains a single integer m. next m lines contain two integers pi, ci separated with space, where pi denotes power and ci denotes co-efficient of pi for polynomial a. after that next line contains a single integer n. next n lines contain two integers pj, cj separated with space, where pj denotes power and cj denotes co-efficient of pj for polynomial b.
Please help me for this i am not able to do this
3. Disarium Number
A number is said to be Disarium if the sum of its digits raised to their respective positions is the number itself.
Example:
75
7^1+5^2=7+25=32 → False
135
1^1+3^2+5^3=1^9+125=135 → True
Print True if a number is a Disarium, otherwise print False.
Input
The Input will be any integer
135
Output
True
add two polynomials given two polynomials a and b, write a program that adds the given two polynomials a and b. input the first line contains a single integer m. next m lines contain two integers pi, ci separated with space, where pi denotes power and ci denotes co-efficient of pi for polynomial a. after that next line contains a single integer n. next n lines contain two integers pj, cj separated with space, where pj denotes power and cj denotes co-efficient of pj for polynomial b.
How to print 0 in the code for this question since i am trying this question from last 1 mnth i am not passing test casses please help me to do this
Compare python and c++ programming base on your experience. Minimum of 200 words
Online Book Merchants offers premium customers 1 free book with every purchase of 5 or more books and offers 2 free books with every purchase of 8 or more books. It offers regular customers 1 free book with every purchase of 7 or more books, and offers 2 free books with every purchase of 12 or more books. Write a statement that assigns freeBooks the appropriate value based on the values of the boolean variable isPremiumCustomer and the int variable nbooksPurchased.
the out put should be 12x^4 + 9x^3 - 5x^2 - x - 1 but our code does not give this out putGiven two polynomials A and B, write a program that adds the given two polynomials A and B.
Input
5
0 -2
3 6
4 7
1 -3
2 -1
5
0 1
1 2
2 -4
3 3
4 5
Your Output
12x^4 + 9x^3 - 5x^2 - 1x - 1
Expected
12x^4 + 9x^3 - 5x^2 - x - 1
Please Find Error
Given two polynomials A and B, write a program that adds the given two polynomials A and B.Input
Input
7
0 2
1 3
2 1
5 0
3 6
4 7
6 -9
5
0 1
2 4
3 0
1 0
4 -5
Your Output : - 9x^6 + 2x^4 + 6x^3 + 5x^2 + 3x + 3
Expected: -9x^6 + 2x^4 + 6x^3 + 5x^2 + 3x + 3I need exact output like this expected output and I want to pass each and every testcase for this program