#include <stdio.h> #include <stdlib.h> // 亲密数 void computer(int n) { int temp=0,tempN=0,i; for(i=1;i<=n/2;i++) { if(n%i==0) { temp+=i; } } for(i=1;i<=temp/2;i++) { if(temp%i==0) { tempN+=i; } } if(n==tempN&&n<temp) { printf("%d %d\n",n,temp); } }//computer int main() { int i,m,n; scanf("%d%d", &m, &n); for(i=m;i<n;i++) { computer(i); } return 0; } |
Double click to view unformatted code.