#include <iostream> #include <cstdio> using namespace std; int n,a,b,c,k; long long w; int main() { ios_base::sync_with_stdio(0); cin>>n; int i=1; while(i*i<=n) { if(n%i==0) { int j=1; while(j*j<=((n-i)/i)) { if(((n-i)/i)%j==0) { a=i; b=a*j; c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; b=a*((n-i)/i)/j; if(c!=n-a-b){ c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; } } j+=1; } k=n/i; if(k!=i) { j=1; while(j*j<=((n-k)/k)) { if(((n-k)/k)%j==0) { a=k; b=a*j; c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; b=a*((n-k)/k)/j; if(c!=n-a-b){ c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; } } j+=1; } } } i++; } cout<<w; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #include <iostream> #include <cstdio> using namespace std; int n,a,b,c,k; long long w; int main() { ios_base::sync_with_stdio(0); cin>>n; int i=1; while(i*i<=n) { if(n%i==0) { int j=1; while(j*j<=((n-i)/i)) { if(((n-i)/i)%j==0) { a=i; b=a*j; c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; b=a*((n-i)/i)/j; if(c!=n-a-b){ c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; } } j+=1; } k=n/i; if(k!=i) { j=1; while(j*j<=((n-k)/k)) { if(((n-k)/k)%j==0) { a=k; b=a*j; c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; b=a*((n-k)/k)/j; if(c!=n-a-b){ c=n-a-b; if(a<b&&b<c&&(b%a==0)&&(c%b==0)&&(c%a==0)) w++; } } j+=1; } } } i++; } cout<<w; return 0; } |