题目:
分析:
如果能找到box,那么必须n和m互素,
用辗转相除法,当最大公约数为1时两数互素
AC代码:
import java.util.Scanner;
public class T2104 {
public static int check(int n,int m){
if(m==0)return n;
return check(m ,n%m);
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int m=sc.nextInt();
if(n==-1&&m==-1){
break;
}else{
System.out.println((check(n,m)!=1)?"POOR Haha":"YES");
}
}
}
}