diff --git "a/Retos/Reto #39 - TRIPLES PITAG\303\223RICOS [Media]/c++/AlexCoffing.cpp" "b/Retos/Reto #39 - TRIPLES PITAG\303\223RICOS [Media]/c++/AlexCoffing.cpp" new file mode 100644 index 0000000000..3a53056f83 --- /dev/null +++ "b/Retos/Reto #39 - TRIPLES PITAG\303\223RICOS [Media]/c++/AlexCoffing.cpp" @@ -0,0 +1,65 @@ +#include + +#define lli long long int +#define endL '\n' + +using namespace std; + +void terna(lli); +bool mcd(lli,lli); + +int main() { + lli n; + cin>>n; + terna(n); + return 0; + } + +bool mcd(lli p, lli q) { + lli resp; + do { + resp = q; + q = p%q; + p = resp; + } + while(q!=0); + if(resp==1) + return 1; + else + return 0; + } + +void terna(lli maxi) { + lli p(2),q(1),a((p*p)-(q*q)),b(2*p*q),c((a*a)+(b*b)),i,j; + c = sqrt(c); + while(c<=maxi) { + i=1; + while(c*i<=maxi) { + if(amaxi && j<=1); + } + }