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的更多相关文章

  1. 【LeetCode】1006. Clumsy Factorial 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 直接eval 日期 题目地址:https://lee ...

  2. 【leetcode】1006. Clumsy Factorial

    题目如下: Normally, the factorial of a positive integer n is the product of all positive integers less t ...

  3. [Swift]LeetCode1006. 笨阶乘 | Clumsy Factorial

    Normally, the factorial of a positive integer n is the product of all positive integers less than or ...

  4. Leetcode 1006. 笨阶乘

    1006. 笨阶乘  显示英文描述 我的提交返回竞赛   用户通过次数305 用户尝试次数347 通过次数309 提交次数665 题目难度Medium 通常,正整数 n 的阶乘是所有小于或等于 n 的 ...

  5. 【LeetCode】172. Factorial Trailing Zeroes

    Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your ...

  6. 【一天一道LeetCode】#172. Factorial Trailing Zeroes

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  7. LeetCode算法题-Factorial Trailing Zeroes(Java实现)

    这是悦乐书的第183次更新,第185篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第42题(顺位题号是172).给定一个整数n,返回n!中的尾随零数.例如: 输入:3 输 ...

  8. 【LeetCode】172. Factorial Trailing Zeroes 解题报告(Java & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 递归 循环 日期 题目描述 Given an integer ...

  9. Swift LeetCode 目录 | Catalog

    请点击页面左上角 -> Fork me on Github 或直接访问本项目Github地址:LeetCode Solution by Swift    说明:题目中含有$符号则为付费题目. 如 ...

随机推荐

  1. go——方法

    方法是与对象实例绑定的特殊函数.方法是面向对象编程的基本概念,用于维护和展示对象的自身状态.对象是内敛的,每个实例都有各自不同的独立特征,以属性和方法来暴露对外通信接口.普通函数则专注于算法流程,通过 ...

  2. git分支更新代码命令

    第一步: 查看状态  git status 第二步: 全部添加  git add --all 第三步: 再次查看状态  git status 第四步: 提交      git commit -m '备 ...

  3. iOS程序的启动过程介绍

    大家在学习iPhone开发时候,都会写HelloWorld程序.大家一般都是通过向导,生成项目,然后通过模拟器启动应用程序.但是大家知道其背后的启动过程吗?也就是当点击程序图标启动程序开始到退出程序整 ...

  4. Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) A. Oath of the Night's Watch

    地址:http://codeforces.com/problemset/problem/768/A 题目: A. Oath of the Night's Watch time limit per te ...

  5. LeetCode: Find Largest Value in Each Tree Row

    BFS /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * ...

  6. JS与Jquery 中的extend用法不同

    1, Jquery //jQuery 应用扩展   jQuery.extend({                  // 定义setApDiv     setApDiv:function () {  ...

  7. Nested DollsHDU1677

    /*题意:有n个矩形,用长和宽表示,如果一个的长和宽都比另一个小,那么这个嵌放在另一个中 所以先对w从大到小排序,w一样的按h从小到大排序,那么就从后面的箱子往前找,只要前面找到一个人h比自己大的就放 ...

  8. Linux静默安装Oracle

    打算在云服务器上装oracle服务,以前DBA美眉都是在图形化界面下安装,这次抓瞎了.赶紧上网查查,静默安装可以解决问题.于是乎赶紧开始部署,过程如下.安装环境:操作系统:CentOS 7内存:11G ...

  9. C++命名(自定义)

    1.自定义函数 void GetName(): 2.布尔型变量 BOOL ISOPEN:

  10. Spring核心技术AOP实现原理

    关于Spring的AOP也是Spring的非常重要的一项技术.大致上可以这样说,面向切面编程,它的出现说明可以在不修改代码的情况下实现对功能的增强.而增强就是给一个方法增加一些功能.AOP主要思想就是 ...