Problem 1
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的更多相关文章
- 1199 Problem B: 大小关系
求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...
- 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 ...
- C - NP-Hard Problem(二分图判定-染色法)
C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144 ...
- Time Consume Problem
I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...
- Programming Contest Problem Types
Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...
- hdu1032 Train Problem II (卡特兰数)
题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能. (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...
- BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】
2301: [HAOI2011]Problem b Time Limit: 50 Sec Memory Limit: 256 MBSubmit: 4032 Solved: 1817[Submit] ...
- [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 ...
- [LeetCode] The Skyline Problem 天际线问题
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...
- PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案
$s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...
随机推荐
- Android中加入水平线和垂直线
1.加入水平线 <View android:layout_height="0.5dip" android:background="#686868" and ...
- gephi——怎样上传节点表格而且为节点设定颜色类型
使用gephi过程中出现两个问题: 一.节点编号不安给定的属性(Nodes)编号,而是莫名其妙地从1w+開始 解决:数据列名中需包括 id.则默觉得节点编号 二.怎样在上传的数据中指定节点颜色 须要一 ...
- 0x58 数据结构优化DP
补写一下 poj3171 设f[i]表示覆盖L~i的最小花费,把区间按左端点排序,枚举区间,f[a[i].r]=min{f[a[i].l~(a[top].r-1)]}+a[i].c (当然还要和原值比 ...
- 扩展函数之 IsWhat 简单好用
代码实现: /***扩展函数名细***/ //[IsInRange] ; //以前写法 & num < ) { } //现在写法 , )) { } //datetime类型也支持 //[ ...
- HTTP请求与请求头
HTTP 的请求报文分为三个部分 请求行.请求头和请求体,格式如图:一个典型的请求消息头域,如下所示: POST/GET http://download.microtool.de:80/somedat ...
- asp.net 字符串过滤
/// <summary> /// 去除HTML标记 /// </summary> /// <param name="Htmlstring">包 ...
- winFrom线程
方法--->委托--->BeginInvoke用指定的参数异步执行委托 委托就是我想做什么,而你可以作什么,我就让你去做.
- Canvas实现环形进度条
Canvas实现环形进度条 直接上代码: <canvas width="200" height="200" >60%</canvas> ...
- Splay树
class SplayNode { public: SplayNode *child[]; char value; int size; bool flip; SplayNode(), flip(fal ...
- 用opcity模拟zindex渐变的效果
github地址: https://github.com/echoorx/opacity-Gradient zindex好像不能渐变改变,所以用opcity来模拟 <!DOCTYPE html& ...