牛客巅峰赛S2赛季第十场
import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
* @param n long长整型 老师给牛牛的数字
* @return int整型
*/
public int mathexp (long n) {
// write code here
int ans = 1;
while(n != 0){
ans = ans*(int)(n%10);
n = n/10;
if(n == 0){
if(ans < 10)
break;
else{
n = ans;
ans = 1;
}
}
}
return ans;
}
} 