Z - Three Numbers Given two numbers K and S. Determine how many different values of X, Y and Z such that (0


Write a program in C++


Z - Three Numbers<br>Given two numbers K and S. Determine how many different values of X, Y and Z such that<br>(0 < X, Y, Z < K) and X+Y + Z = S.<br>Input<br>Only one line containing two numbers K and S (0 <K< 3000,0 <S< 3K).<br>Output<br>Print the answer required above.<br>Examples<br>Input<br>2 1<br>Output<br>3<br>Input<br>9 4<br>Output<br>15<br>Note<br>In the first test case all values of X, Y, Z that satisfy the conditions are :<br>001<br>010<br>100<br>In the second test case all values of X, Y, Z that satisfy the conditions are :<br>XYZ<br>XYZ<br>XYZ<br>XYZ<br>004<br>040<br>202<br>310<br>013<br>10 3<br>211<br>400<br>022<br>112<br>220<br>130<br>031<br>121<br>301<br>

Extracted text: Z - Three Numbers Given two numbers K and S. Determine how many different values of X, Y and Z such that (0 < x,="" y,="" z="">< k)="" and="" x+y="" +="" z="S." input="" only="" one="" line="" containing="" two="" numbers="" k="" and="" s="" (0=""><>< 3000,0 3000,0="">
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here