Problem 1

# Problem_1.py
"""
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
1000一下3的倍数以及5的倍数之和
""" three = [i for i in range(0, 1000, 3)]
five = [i for i in range(0, 1000, 5)]
overlap = [i for i in three if i in five] all = sum(three) + sum(five)
all -= sum(overlap) print(all)

Problem 1的更多相关文章

  1. 1199 Problem B: 大小关系

    求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...

  2. No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

    Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...

  3. C - NP-Hard Problem(二分图判定-染色法)

    C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144 ...

  4. Time Consume Problem

    I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...

  5. Programming Contest Problem Types

        Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...

  6. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  7. BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】

    2301: [HAOI2011]Problem b Time Limit: 50 Sec  Memory Limit: 256 MBSubmit: 4032  Solved: 1817[Submit] ...

  8. [LeetCode] Water and Jug Problem 水罐问题

    You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...

  9. [LeetCode] The Skyline Problem 天际线问题

    A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...

  10. PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案

    $s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...

随机推荐

  1. 使用Windows上SourceInsight工具建立分析Linux下uboot源代码project

    SourceInsight软件能够说是分析查阅大型源代码project文件的神器!界面不错.功能强大! 第一步:安装好SourceInsight后打开软件 点击上面的Project--->new ...

  2. Node.js具体解析

    介绍 JavaScript 高涨的人气带来了非常多变化.以至于现在使用其进行网络开发的形式也变得截然不同了.就如同在浏览器中一样,现在我们也能够在server上执行 JavaScript ,从前端跨越 ...

  3. Android中验证输入是否为汉字及手机号,邮箱验证,IP地址可用port号验证

    1,验证是否为汉字 // 验证昵称 private boolean verifyNickname() { String nickname = edt_username.getText().toStri ...

  4. Selenium实例----12306网站测试

    http://blog.csdn.net/xc5683/article/details/9629827

  5. notifyDataSetChanged()刷新ListView(使用JSONArray绑定的Adapter)

    1.fragment代码: package com.ts.fragment; import java.util.ArrayList; import java.util.HashMap; import ...

  6. bzoj5029: 贴小广告&&bzoj5168: [HAOI2014]贴海报

    以后做双精题请至少先跑个数据...输入都不一样... 做法就是离散化大力线段树. 记得在x+1和y-1插点 看这个数据: 1000 121 10050 8080 9950 981 56100 2002 ...

  7. 一篇个人感觉比较好的lua入门的文章

    原文转自www.cppprog.com,由三篇文章组成 Lua是一个嵌入式的脚本语言,它不仅可以单独使用还能与其它语言混合调用.Lua与其它脚本语言相比,其突出优势在于: 1.  可扩展性.Lua的扩 ...

  8. lua中.和:的区别

    local myTable = {} function myTable:putMyname(val) print(val) print(self and self.name) end myTable. ...

  9. Android + Eclipse + NDK + cygwin配制

    以前做NDK开发时留下来的笔记,希望对后继开发人员有所帮助,在开放给大家使用,有不对的地方请留,扔砖头都可以的. 为了方便在Win32下开发android C++ 程序,我们作了如下配制:1.Andr ...

  10. python课程设计笔记(二)破冰基本语法

    python两种编程方式:交互式与文件式 交互式:语法练习,输一条运行一条 文件式:通用,执行一组语句 注释 #单行注释  ...XXXXX...多行注释 逻辑 没有大括号,按缩进确定逻辑——缩进格数 ...