//Damian Kokot //5.12.2018 #include <cstdio> int main(){ int n,licz=0; scanf("%d",&n); for(int i=1;i*i<=n;++i){ if(n%i==0){ int m=n/i-1; for(int j=2;j*j<=m;++j){ if(m%j==0 && m/j>2){ //printf("%d %d %d\n",i,i*j,(m/j-1)*i *j); licz++; int k=m/j; if(j!=k && m/k>2){ //printf("%d %d %d\n",i,i*k,i*k*(m/k-1)); licz++; } } } if(n/i!=i && i>6){ m=i-1; for(int j=2;j*j<=m;++j){ if(m%j==0 && m/j>2){ //printf("%d %d %d\n",i,i*j,(m/j-1)*i *j); licz++; int k=m/j; if(j!=k && m/k>2){ //printf("%d %d %d\n",i,i*k,i*k*(m/k-1)); licz++; } } } } } } printf("%d\n",licz ); 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 | //Damian Kokot //5.12.2018 #include <cstdio> int main(){ int n,licz=0; scanf("%d",&n); for(int i=1;i*i<=n;++i){ if(n%i==0){ int m=n/i-1; for(int j=2;j*j<=m;++j){ if(m%j==0 && m/j>2){ //printf("%d %d %d\n",i,i*j,(m/j-1)*i *j); licz++; int k=m/j; if(j!=k && m/k>2){ //printf("%d %d %d\n",i,i*k,i*k*(m/k-1)); licz++; } } } if(n/i!=i && i>6){ m=i-1; for(int j=2;j*j<=m;++j){ if(m%j==0 && m/j>2){ //printf("%d %d %d\n",i,i*j,(m/j-1)*i *j); licz++; int k=m/j; if(j!=k && m/k>2){ //printf("%d %d %d\n",i,i*k,i*k*(m/k-1)); licz++; } } } } } } printf("%d\n",licz ); return 0; } |