Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A Pythagorean triple consists of three positive integers a, b, and c, such that

ID: 3876311 • 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

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

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());

var k,i,j;
for(i=n;i>=1;i--)
{
   for(j=1;j<=n;j++)
   {
       if(i!=j)
       {
       k=n-i-j;
       if(i^2+j^2===k^2 || i^2+k^2===j^2 || k^2+j^2===i^2)
       {
           break 2;
       }
       }
   }
}
console.log("Three Number are : "+i+","+j+","+k);

}