Multiples of 3 and 5
2024-09-29 12:17:04
#include<stdio.h> int main(void){
int n1, n2,n3;
n1=333*(3+999)/2;
n2=199*(5+995)/2;
n3=66*(15+990)/2;
printf("%d\n",n1+n2-n3);
n1=getchar();
return 0;
}
Multiples of 3 and 5
Problem 1
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.
算法
最新文章
- VS2010 使用时选择代码或双击时出错,点击窗口按钮后VS自动重启问题
- NYOJ-85 有趣的数 AC 分类: NYOJ 2014-01-17 21:42 240人阅读 评论(0) 收藏
- jQuery实现 浏览器后退到上次浏览位置
- java中Arrays类中,binarySearch()方法的返回值问题
- matlab实现不动点迭代、牛顿法、割线法
- css3:user-select属性
- 微信分享jssdk config:invalid signature 签名错误
- appium简明教程
- SparkMLlib回归算法之决策树
- POJ1743:Musical Theme
- 《深入理解JAVA虚拟机》笔记1
- 线段树(区间树)之区间染色和4n推导过程
- filter以及reduce的用法
- java基础 ---- 练习for循环
- jQuery的事件,动画效果等
- 有趣的线段树模板合集(线段树,最短/长路,单调栈,线段树合并,线段树分裂,树上差分,Tarjan-LCA,势能线段树,李超线段树)
- rabbitmq install erlang faild
- topcoder srm 390 div1
- matlab学习(2) sort、sortrows
- nc 命令使用详解