1105: 判断友好数对(函数专题)
import java.util.Scanner;
public class Main {
public static int FacSum(int n){
int res=0;for(int i=1;i<=n/2;i++)if(n%i==0)res+=i;return res;}public static void main(String[] args){
Scanner cin = new Scanner(System.in);int m=cin.nextInt();int n=cin.nextInt();boolean flag=false;for(int i=m;i<=n;i++){
int temp=FacSum(i);if(FacSum(temp)==i&&i<temp){
flag=true;System.out.println(i+" "+temp);}}if(!flag) System.out.println("No answer");}
}