【leetcode】504. Base 7
problem
solution:
class Solution {
public:
string convertToBase7(int num) {
if(num==) return "";
string ans = "";
int number = abs(num);
while(number>)
{
ans = to_string(number%) + ans;
number /= ;
}
if(num<) ans = "-" + ans;
return ans;
}
};
参考
完
【leetcode】504. Base 7的更多相关文章
- 【LeetCode】504. Base 7 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 内建库 BigInteger类 逐位计算 倍数相加 ...
- 【LeetCode】Minimum Depth of Binary Tree 二叉树的最小深度 java
[LeetCode]Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum dept ...
- 【Leetcode】Pascal's Triangle II
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3 ...
- 53. Maximum Subarray【leetcode】
53. Maximum Subarray[leetcode] Find the contiguous subarray within an array (containing at least one ...
- 27. Remove Element【leetcode】
27. Remove Element[leetcode] Given an array and a value, remove all instances of that value in place ...
- 【刷题】【LeetCode】007-整数反转-easy
[刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接-空 007-整数反转 方法: 弹出和推入数字 & 溢出前进行检查 思路: 我们可以一次构建反转整数的一位 ...
- 【刷题】【LeetCode】000-十大经典排序算法
[刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接 000-十大经典排序算法
- 【leetcode】893. Groups of Special-Equivalent Strings
Algorithm [leetcode]893. Groups of Special-Equivalent Strings https://leetcode.com/problems/groups-o ...
- 【leetcode】657. Robot Return to Origin
Algorithm [leetcode]657. Robot Return to Origin https://leetcode.com/problems/robot-return-to-origin ...
随机推荐
- ubuntu 16.04 TLS 安装VNC
安装 #autocuftsel 用于vnc两段的复制粘贴 sudo apt-get install autocutsel 安装 vncserversudo apt-get install --no-i ...
- 23、自动装配-Aware注入Spring底层组件&原理
23.自动装配-Aware注入Spring底层组件&原理 Aware 接口,提供了类似回调函数的功能 自定义组件想要使用Spring 容器底层的一些组件(Application Context ...
- python执行ad_hoc
import shutil from collections import namedtuple from ansible.parsing.dataloader import DataLoader f ...
- sql server 的 out 和output
sql中out与output --SQLQuery Create By Faywool create proc Proc_OutPutTest--创建 @numA int,--nu ...
- word黏贴图片显示不出来
word图片转存,是指UEditor为了解决用户从word中复制了一篇图文混排的文章粘贴到编辑器之后,word文章中的图片数据无法显示在编辑器中,也无法提交到服务器上的问题而开发的一个操作简便的图片转 ...
- mkdir/rmdir/install/mktemp
mkdir rmdir很有趣,如果加上p选项,如果删除空目录后,其父目录是空,则一并删除,所以如果都是空的,那么就会全家删 a用户不能修改b用户的文件,但是却可以删除 install 创建文件并赋权 ...
- [Luogu] U18202 洞穴遇险
https://www.luogu.org/problemnew/show/U18202 暴力搜索预期得分3030分左右. 状压预期得分7070分左右. 考虑费用流,将剩余不稳定度和最小转为消除不稳定 ...
- (转)python正向连接后门
python正向连接后门 PHITHON 2014 四月 12 00:12 阅读:16670 Python python, cmd后门, socket python在linux ...
- zabbix之自定义告警
zabbix支持内置的告警类型.email,sms,等 有时候需要自定义类型的. [其他微信,钉钉都差不多方式,只是脚本不一样] 自定义告警类型[自定义邮件] 编写自定义脚本,并测试成功. [脚本需要 ...
- linux下查看内存频率,内核函数,cpu频率
查看CPU: cat /proc/cpuinfo # 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理 ...