当前位置:网站首页>剑指 Offer 14- II. 剪绳子 II
剑指 Offer 14- II. 剪绳子 II
2022-06-29 23:06:00 【anieoo】
solution:
贪心
const int mod = 1000000007;
class Solution {
public:
int cuttingRope(int n) {
if(n <= 3) return n - 1;
long res = 1;
while(n > 4){
res *= 3;
res = res % mod;
n -= 3;
}
return (int)(res * n % mod);
}
};边栏推荐
- 语音信号处理(二): 发声生理、听觉生理与听觉心理
- 开源了 | 文心大模型ERNIE-Tiny轻量化技术,又准又快,效果全开
- Golang code specification sorting
- C pointer advanced 2-- > function pointer array callback function simplifies calculator code, and implements qsort function based on callback function simulation
- 缓冲流练习
- Fund valuation, expenses and accounting
- Database - playful data -pgsql uses UUID as primary key
- [cooking record] - hot and sour cabbage
- SYSTEMd debugging
- 深度学习的历史
猜你喜欢

“微博评论”的高性能高可用计算架构

Regular expressions: characters (2)

High performance and high availability computing architecture of "Weibo comments"
![PROJECT #1 - BUFFER POOL [CMU 15-445645]笔记](/img/33/304e3e78f62b156d0863a41d243679.png)
PROJECT #1 - BUFFER POOL [CMU 15-445645]笔记

Redis client

众昂矿业:萤石助力氟产业锂电建设发展

How can the local / park do a good job in industrial analysis?

语音信号处理(三):语音信号分析【连续的“模拟信号”--采样、量化、编码-->离散的“数字信号”】

Vs cannot locate program input point to DLL

80-Redis详解
随机推荐
Weekly Postgres world news 2022w25
Solr basic operation 5
Solr basic operation 4
Mysql database: storage engine
High performance and high availability computing architecture of "microblog comments" in microblog system
111. simple chat room 14: chat room client
正则表达式:字符(2)
Effective self summary of remote communication | community essay solicitation
Redis client
语音信号处理(三):语音信号分析【连续的“模拟信号”--采样、量化、编码-->离散的“数字信号”】
CE second operation
采购数智化爆发在即,支出宝“3+2“体系助力企业打造核心竞争优势
软件测试 接口测试 Jmeter 5.5 安装教程
剑指 Offer 38. 字符串的排列
[cooking record] - hot and sour cabbage
C pointer advanced 1-- > character pointer, array pointer, pointer and array parameter transfer, function pointer
80-Redis详解
深度学习的历史
分布式消息中间件设计
Uniapp copy contents to clipboard