技术栈

Golang | Leetcode Golang题解之第372题超级次方

__AtYou__2024-08-28 20:31

题目:

题解:

Go 复制代码
const mod = 1337

func pow(x, n int) int {
    res := 1
    for ; n > 0; n /= 2 {
        if n&1 > 0 {
            res = res * x % mod
        }
        x = x * x % mod
    }
    return res
}

func superPow(a int, b []int) int {
    ans := 1
    for _, e := range b {
        ans = pow(ans, 10) * pow(a, e) % mod
    }
    return ans
}
上一篇:WPF 手撸插件 七 日志记录(二)
下一篇:445端口是啥?445端口怎么关闭?
相关推荐
玛丽莲茼蒿
1 天前
Leetcode hot100 每日温度【中等】
算法·leetcode·职场和发展
样例过了就是过了
1 天前
LeetCode热题100 分割等和子集
数据结构·c++·算法·leetcode·动态规划
北顾笙980
1 天前
day38-数据结构力扣
数据结构·算法·leetcode
m0_62949473
1 天前
LeetCode 热题 100-----14.合并区间
数据结构·算法·leetcode
xin_nai
1 天前
LeetCode热题100(Java)(5)普通数组
算法·leetcode·职场和发展
水蓝烟雨
1 天前
3337. 字符串转换后的长度 II
算法·leetcode
_日拱一卒
1 天前
LeetCode:226翻转二叉树
数据结构·算法·leetcode
踩坑记录
1 天前
leetcode hot100 64. 最小路径和 medium 递归优化
leetcode·深度优先
lolo大魔王
1 天前
Go语言的并发、协调创建和通信机制
开发语言·golang
样例过了就是过了
1 天前
LeetCode热题100 最长有效括号
c++·算法·leetcode·动态规划
热门推荐
01要裂开了!ChatGPT要手机号验证了?注册Codex要求验证电话号码怎么办?2026年登陆Codex要手机号验证的解决办法02GitHub 镜像站点03裂开!ChatGPT 居然开始要手机号验证,附详细解决方法04【AI】2026 年具身智能模型和世界模型总结05Codex 接入 DeepSeek API 完整配置文档062026年4月AI大事件深度解读:大模型竞争进入“深水区“07实测可用|小米 MiMo 百万亿 Token 免费领,开发者速冲082026年AI前瞻:量子AI、具身智能与科学发现的新纪元09零基础教你claude code 接入 deepseek V410在Windows 11上安装Docker的踩坑记录