A Pythagorean triple consists of three positive integers a, b, and c, such that
ID: 3876285 • Letter: A
Question
A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2.
N is a natural number and there's only one Pythagoren triple set which satisfies the condifition a + b + c = N. Given N can you find the values for a, b and c?
Input Format
It contains a natural number, N.
Output Format
Print the answer to stdout.
Sample Input
Sample Output
Explanation
For the input N, we have the following numbers which satisfy the condition: 200, 375, 425.
2002 + 3752 = 4252
200 + 375 + 425 = 1000
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = '';
var input_stdin_array = '';
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split(' ');
main();
});
function readLine() {
return input_stdin_array[input_currentline++];
}
/////////////// dont modify the lines above ////////////////////
function main() {
var n = parseInt(readLine());
// console.log("answer");
}
SOLVE AND ADD THIS TO JAVASCRIPT
Explanation / Answer
Here is the solution :
function main() {
var n = parseInt(readLine());
var a;
}
These code works perfectly.