Write output of following piece of code: b) #include #include using namespace std; MIRPUR int main() const
Fantastic news! We've Found the answer you've been seeking!
Question:
Write output of following piece of code:
Transcribed Image Text:
b) #include <string.h> #include <iostream> using namespace std; MIRPUR int main() const int MAX_NUM = 9; const int MAX_NOS = 9; const int MAX_SUM_VAL = 100; int n, s, dp[MAX_NOS + 1][MAX_NUM + 1][MAX_SUM_VAL + 1]; long long SUM_VAL = 0; memset(dp, 0, sizeof(dp)); for (int i = 0; i < MAX_NUM; i++) dp[1][i][] = 1; for (int N = 2; N <= MAX_NOS; N++) for (int i = 1; i <= MAX_NUM; 1++) for (int j = 1; j <= MAX_SUM_VAL; j++) if ( -i >= 0) { for (int k = 0; k< i; k++) { dp[N][i[J] += dp[N -1][k][j-i]; cin >> n >> s; SUM_VAL = 0; for (int i = 0; i <= MAX_NUM; i++) SUM_VAL += dp[n][i][s]; } cout << "Number of digits " <<n << " and Sum = " << s; cout << "InNumber of pairs: " <«SUM_VAL << endl; return 0; b) #include <string.h> #include <iostream> using namespace std; MIRPUR int main() const int MAX_NUM = 9; const int MAX_NOS = 9; const int MAX_SUM_VAL = 100; int n, s, dp[MAX_NOS + 1][MAX_NUM + 1][MAX_SUM_VAL + 1]; long long SUM_VAL = 0; memset(dp, 0, sizeof(dp)); for (int i = 0; i < MAX_NUM; i++) dp[1][i][] = 1; for (int N = 2; N <= MAX_NOS; N++) for (int i = 1; i <= MAX_NUM; 1++) for (int j = 1; j <= MAX_SUM_VAL; j++) if ( -i >= 0) { for (int k = 0; k< i; k++) { dp[N][i[J] += dp[N -1][k][j-i]; cin >> n >> s; SUM_VAL = 0; for (int i = 0; i <= MAX_NUM; i++) SUM_VAL += dp[n][i][s]; } cout << "Number of digits " <<n << " and Sum = " << s; cout << "InNumber of pairs: " <«SUM_VAL << endl; return 0;
Expert Answer:
Related Book For
Statistics for Business and Economics
ISBN: 978-0132930192
8th edition
Authors: Paul Newbold, William Carlson, Betty Thorne
Posted Date:
Students also viewed these programming questions
-
Write output of following piece of code a) #include #include using namespace std; string arith_geo_sequence(int nums[], const int size) { int diff_arith = 0, diff_geo = 0; bool arith_flag = true,...
-
Hong Kongs Four Seas Fishballs is the chosen case for this term. Four Seas Fishballs which was found in 1977 is one of the famous food productions in Hong Kong. Taking the role as a marketing manager...
-
Write output of following program. #include using namespace std; void repchar(char, int); int main() { repchar(-, 43); cout << Data type Range << endl; repchar(=, 23); cout << char...
-
Kebri LTD. sells Radios and Televisions. They have recorded their monthly revenue as follows. Revenue(Y) 330 180 209 390 391 304 347 461 538 610 Radio units (X1) 55 71 92 113 134 156 171 193 219 232...
-
On December 31, 2016, Mason Company made the following proper year-end adjusting entries: Required: 1. Prepare journal entries to record whatever reversing entries you think are appropriate. 2....
-
1n a manufacturing process, stainless steel cylinders (AISI 304) initially at 600 K are quenched by submersion in an oil bath maintained at 300 K with h = 500 W/m2 K. Each cylinder is of length 2L =...
-
Isabella Lopez plans to open a company that will design and manufacture accessories for smartphones. In preparing to do this, she read that having a clearly articulated business model will help all...
-
STOCKHOLDERS' EQUITY SECTION After closing its books on December 31, 20', Jackson Corporation's stockholders' equity accounts had the following balances: REQUIRED Prepare the stockholders' equity...
-
6.Max Co is a large multinational company which expects to have a $10m cash deficit in one month's time. The deficit is expected to last no more than two months. Max Co wishes to resolve its...
-
For the case The WM. Wrigley Jr. Company: Capital Structure, Valuation, and the Cost of Capital(Darden Case: UVAF1482) please answer the following questions and explain your reasoningwhere...
-
Which of the following statements regarding inventory are incorrect? 1)Other than the cost, holding inventory is good for operations. 2)Inventories account for between 60 and 80 percent of a typical...
-
1- Response time is an important performance measure when searching on-line (for example, at Hotels.com or TatilSepeti.com) if a hotel is available for a certain day. It is defined as the length of...
-
Do you believe the federal government of Canada should limit the number ofimmigrants it accepts? https://globalnews.ca/news/5397306/canada--poll/immigration
-
In what ways can we effectively monitor the return on investment in charity work?
-
Can you think of a display rule for emotions that is not mentioned in the chapter? What is it and why do you think this norm developed?
-
You need to write the summary of "The need for disruptive change inside Blackberry" in two paragraphs.
-
Part 1: Using SQL to Modify a Database (35 points total) Consider the following schema for a book database. bookDB: COLUMN BookID CategoryID Title Price Pages CIS9340 Exam 2 Book DATA TYPE INT INT...
-
Why are stocks usually more risky than bonds?
-
Compute SSR, SSE, s2e, and the coefficient of determination, given the following statistics computed from a random sample of pairs of X and Y observations. a. (y-9)-100,000, R2 = 0.50, " = 52 b. ...
-
A consumer product that has flourished in the last few years is bottled natural spring water. Jon Thorne is the CEO of a company that sells natural spring water. He has requested a report of the...
-
A college has 3,200 undergraduate students and 800 graduate students. Researchers are interested in the amount of money spent in a year on textbooks by these students. Initially, simple random...
-
Can you create a graphic that highlights each incidence where Fairmont was not in compliance with company policy that requires explicit approval of all hours of eighty hours or more?
-
In addition to financial reporting fraud, what other types of asset misappropriation schemes were perpetrated by the Rigas family members?
-
Why was Adelphia cable company formed?
Study smarter with the SolutionInn App