import org.junit.Test;
public class solution {
@Test
public void testFunc(){
int maxYueShu = maxYueShu(12, 8);
System.out.println("res: "+maxYueShu);
}
public int maxYueShu(int a, int b){
if (a>b) {
int temp = a;
a = b;
b=temp;
}
for(int i=a;i>=Math.ceil(Math.sqrt(a*1.0));i--){
if (a%i==0 && b%i==0) {
return i;
}
}
return 0;
}
}
301

被折叠的 条评论
为什么被折叠?



