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. c# Datagridview 设置单位格为编辑状态(in editing mode)

    private void dataGridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Tab && ...

  2. 初学hadoop的个人历程

       在学习hadoop之前,我就明确了要致力于大数据行业,成为优秀的大数据研发工程师的目标,有了大目标之后要分几步走,然后每一步不断细分,采用大事化小的方法去学习hadoop.下面开始叙述我是如何初 ...

  3. Python框架之Tornado(源码之褪去模板外衣的前戏)

    执行字符串表示的函数,并为该函数提供全局变量 本篇的内容从题目中就可以看出来,就是为之后剖析tornado模板做准备,也是由于该知识点使用的巧妙,所有就单独用一篇来介绍了.废话不多说,直接上代码: # ...

  4. vue移动端 滚动 鼠标按下效果

    <div class="item" :id="item.RowID" @touchstart="touchstart(item.RowID)&q ...

  5. C#中ReferenceEquals和Equals的区别

    ReferenceEquals()判断两个字符串是否指向相同的内存地址:(判断引用) Equals,先判断两个字符串有相同的内存位置,是则两个字符串相等:否则逐字符比较两个字符串,判断是否相等(先判断 ...

  6. MySQL-5.7创建及查看数据库

    1.创建数据库语句 create database语句是在MySQL实例上创建一个指定名称的数据库. create schema语句的语义和create database是一样的. 2.语法解析 CR ...

  7. PHP 网站隔离配置

    PHP网站间隔离 网站内目录与目录之间是可以访问的,在某些特定情况下这样是不安全的,如果目录间网址权限被黑客利用很可能造成数据流失,在这里我们可以通过PHPopen_basedir来实现网站间目录隔离 ...

  8. 动态背景的CSS3登录表单

    在线演示 本地下载

  9. Book Review of “The practice of programming” (Ⅱ)

    The practice of programming Chapter 2 Algorithms and Data Structures Searching sequential search (li ...

  10. Android Studio Gradle Could not reserve enough space for object heap

    Studio 创建第一个工程报错 Error:Unable to start the daemon process.This problem might be caused by incorrect ...