数学实验
比赛主页
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
64bit IO Format: %lld
题目描述
给出一个数字n,需要不断地将所有数位上的值做乘法运算,直至最后数字不发生变化为止。
问最后生成的数字为多少?
示例1
输入
复制
10
10
返回值
复制
0
0
示例2
输入
复制
55
55
返回值
复制
0
0
说明
55 -> 5 * 5 = 25 -> 2 * 5 = 10 -> 1 * 0 = 0
备注:
数学实验
返回全部题目
列表加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n long长整型 老师给牛牛的数字 * @return int整型 */ public int mathexp (long n) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n long长整型 老师给牛牛的数字 * @return int整型 */ int mathexp(long long n) { // write code here } };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # @param n long长整型 老师给牛牛的数字 # @return int整型 # class Solution: def mathexp(self , n ): # write code here
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n long长整型 老师给牛牛的数字 * @return int整型 */ function mathexp( n ) { // write code here } module.exports = { mathexp : mathexp };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # @param n long长整型 老师给牛牛的数字 # @return int整型 # class Solution: def mathexp(self , n ): # write code here
package main /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n long长整型 老师给牛牛的数字 * @return int整型 */ func mathexp( n int64 ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n long长整型 老师给牛牛的数字 * @return int整型 */ int mathexp(long long n ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # @param n long长整型 老师给牛牛的数字 # @return int整型 # class Solution def mathexp(n) # write code here end end
10
0
55
0