uva1363
来源:互联网 发布:淘宝代缴公积金靠谱么 编辑:程序博客网 时间:2024/05/21 01:52
<pre name="code" class="cpp">/**********author:chanjun2016email:15755396353@163.com***********/#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <vector>#include <string>#include <map>#include <set>#include <algorithm>using namespace std;#define INF = 0x3f3f3f3flong long n,k;int main(){while (~scanf("%lld%lld",&n,&k)){long long ans = 0;for (int i = 1;i <= n;){int p = k / i;if (p == 0){ans += k * (n - i + 1);break;}else{long long j = min(n,k / p); //这里的j不能为int,否则会wrans += (k - i * p) * (j - i + 1) - (j - i + 1) * (j - i) / 2 * p;i = j + 1;}}printf("%lld\n",ans);}return 0;}
0 0
- uva1363
- uva1363 Joseph's Problem
- UVa1363 - Joseph's Problem(数论)
- 紫书 例题10-25 约瑟夫的数论问题 UVa1363
- [读书笔记]线程的认识
- const int a = 10; int *p = (int *)&a; *p = 100; a的值到底有没有改变
- iOS9全新的联系人相关框架——Contacts Framework
- Oracle 基于Windows访问带端口的远程服务器
- Android中自定义属性Attr的详解使用.
- uva1363
- Spring Boot——2分钟构建spring web mvc REST风格HelloWorld
- 自动平滑轮播、左右循环view
- Linux共享内存使用常见陷阱与分析
- mac无法充电解决方法
- 网站搜索引擎优化:你需要多个域名?
- 最短路算法(Floyd、Dijsktra、Bellman-Ford、SPFA)
- JS控制图片显示的大小(图片等比例缩放)
- jquery.validate使用攻略 第五步 正则验证