Boston doubts (hit list)

Description] [Title
   Boston do math, so this question you obtain any set of 1 / x + 1 / y + 1 / z = 2 /n solution (x, y, z Ji mutually identical), Kay This question will be sub-Ji, he saw a school of information science contest for you.
[Description] Enter
   an integer n.
Description [output]
    If there is a set of solutions x, y, z satisfy the meaning of the questions, "-1" (Ji quotes), otherwise the output of three numbers separated by a space x, y, z, meet the requirements of the subject, any number must be 10 * ≤2 18 .
[Input] Sample
   3
[] sample output
   2742
[Data] range unconstrained
data right foot 30%, there is a set of solutions satisfying x, y, z satisfies 1≤ x, y, z ≤500;
on the right foot 50% of the data, to meet ≦ 10 n-1 ≦ . 5 .
Data for 100% of the right foot, n-≦ 10 satisfies 1 ≦ . 9 .


answer:

By enumerating found that the presence of each number n, n + 1, n * (n + 1) these three solutions

These three numbers as X, Y, Z are substituted into the equation permanent establishment found

and so. . . . Direct Out Well

code show as below:

#include<bits/stdc++.h>
using namespace std;
long long n;
int main(){
    freopen("math.in","r",stdin);
    freopen("math.out","w",stdout);
    scanf("%lld",&n);
    printf("%lld %lld %lld",n,n+1,n*(n+1));
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/tonyshen/p/11372909.html
Recommended