博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
projecteuler_problem12
阅读量:6955 次
发布时间:2019-06-27

本文共 637 字,大约阅读时间需要 2 分钟。

problem12

地址:。

源码:git@code.aliyun.com:qianlizhixing12/ProjectEuler.git。
问题:1 + 2 + 3 + ...的和中第一个有超过500个因数。

#include 
#include
#include "debug.h"#define NUM 500int main(int argc, char **argv){ int i = 0; int sum = 0; int num = 0; int j; debugTime(); while (num <= NUM){ i++; sum = i * (i + 1) / 2; num = 0; j = 1; while (j <= (sum / j)){ if (0 == (sum % j)){ if (j == (sum / j)) num++; else num += 2; } j++; } } printf("Problem12 Answer: %d\n", sum ); debugTime(); return 0;}

转载地址:http://ngjil.baihongyu.com/

你可能感兴趣的文章
线性空间(向量空间)
查看>>
多媒体之录音
查看>>
mysql 分区类型详解
查看>>
ORACLE同义词总结
查看>>
ios字体设置
查看>>
【SICP练习】51 练习2.19
查看>>
solveCrossprod求 X'X的逆, ( X' == t(X), 即X的行列变换矩阵 )
查看>>
PostgreSQL column cryptographic use pgcrypto extension and optional openssl lib
查看>>
通过支付宝服务中断事件看系统可靠性和YunOS的可靠性
查看>>
oVirt VM (CentOS) template & clone
查看>>
Flutter框架分析(二)-- 初始化
查看>>
mac更新系统后Android studio Git不能用,提示missing xcrun at
查看>>
微信公众号排版
查看>>
Swift基础语法学习-3.类型转换
查看>>
向你安利了一个编辑器,并丢给你一堆插件
查看>>
Flutter 入门之 ListTile 使用指南
查看>>
Android Material Design控件使用(一)——ConstraintLayout 约束布局
查看>>
为什么区块链世界既需要计算机科学家也需要经济学家?
查看>>
Atom 微信小程序文件代码高亮
查看>>
Qtum量子链周报(3月18日-3月24日)
查看>>