Leetcode 1006. Clumsy Factorial
class Solution(object):
def clumsy(self, N):
"""
:type N: int
:rtype: int
"""
op = {0: '*', 1: '//', 2: '+', 3: '-'}
strN = list(map(str, range(N - 1, 0, -1)))
ret = str(N)
for i, s in enumerate(strN):
ret += op[i % 4] + s
return eval(ret)
Leetcode 1006. Clumsy Factorial的更多相关文章
- 【LeetCode】1006. Clumsy Factorial 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 直接eval 日期 题目地址:https://lee ...
- 【leetcode】1006. Clumsy Factorial
题目如下: Normally, the factorial of a positive integer n is the product of all positive integers less t ...
- [Swift]LeetCode1006. 笨阶乘 | Clumsy Factorial
Normally, the factorial of a positive integer n is the product of all positive integers less than or ...
- Leetcode 1006. 笨阶乘
1006. 笨阶乘 显示英文描述 我的提交返回竞赛 用户通过次数305 用户尝试次数347 通过次数309 提交次数665 题目难度Medium 通常,正整数 n 的阶乘是所有小于或等于 n 的 ...
- 【LeetCode】172. Factorial Trailing Zeroes
Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your ...
- 【一天一道LeetCode】#172. Factorial Trailing Zeroes
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...
- LeetCode算法题-Factorial Trailing Zeroes(Java实现)
这是悦乐书的第183次更新,第185篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第42题(顺位题号是172).给定一个整数n,返回n!中的尾随零数.例如: 输入:3 输 ...
- 【LeetCode】172. Factorial Trailing Zeroes 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 递归 循环 日期 题目描述 Given an integer ...
- Swift LeetCode 目录 | Catalog
请点击页面左上角 -> Fork me on Github 或直接访问本项目Github地址:LeetCode Solution by Swift 说明:题目中含有$符号则为付费题目. 如 ...
随机推荐
- go——安装与设置
1.下载安装 官方下载地址:https://golang.org/dl/ 备用下载地址:https://golang.google.cn/dl/ 在windows下面直接运行.msi程序文件就可以安装 ...
- S5第一次月考
# Python五期月考一 # 1 介绍 # 满分100分,90分及格 # # 考试范围: # 1.Python语法 # 2.数据类型 # 3.流程控制 # 4.函数 # 5.模块 # # 考试时间: ...
- java.text.SimpleDateFormat使用介绍
java.text.SimpleDateFormat的使用 java.lang.Object | +----java.text.Format | +-- ...
- [WebException: The underlying connection was closed: The message length limit was exceeded.]解决方法
[WebException: The underlying connection was closed: The message length limit was exceeded.] Syste ...
- 整合subeclipse和Tortoise SVN
先来一个下载链接(subeclipse1.8和TortoiseSVN1.7): http://download.csdn.net/detail/cangfengluyu/8416395 对于同 ...
- CreateWindow创建无边框 可拉伸窗体
createwindow 定义 HWND WINAPI CreateWindow( _In_opt_ LPCTSTR lpClassName, _In_opt_ LPCTSTR lpWindowNam ...
- Linux系统下修改IP地址、网关、DNS的基本方法
临时修改IP地址.网关.主机名.DNS,马上生效,无需重启(重启后失效) 1.修改主机名 #hostname Slyar 2.修改IP地址(eth0为网卡名称) #ifconfig eth0 192. ...
- SpringBoot 通用返回类设计
在项目中通常需要为前端设计通过的返回类,返回的格式为: { "status": "success", "data": {...} } 定义通 ...
- HDU 5704
题意:n个人参加一个游戏,每个人选择0-100范围的数.m为选择的所有数的平均数*2/3,选择的数<=m且距离m最近的人获胜,若同时有多人满足条件则随机抽取胜者.如果一个人选的数,比m小,且相距 ...
- SpringBoot2.0之整合ElasticSearch
就类比数据库到时候去实现 服务器端配置 集群名字 与yml名字一致 pom: <project xmlns="http://maven.apache.org/POM/4.0.0&qu ...