UVA 1363(p338)----Joseph's Problem
来源:互联网 发布:经济增长数据 编辑:程序博客网 时间:2024/04/28 20:32
#include<iostream>#include<cstdio>using namespace std;int n,k;int main(){ while(scanf("%d%d",&n,&k)==2&&n) { long long ans=0; int i=1; while(i<=n) { long long cnt=n-i; long long p=k/i; long q=k%i; if(p>0) cnt=min(cnt,q/p); ans+=(cnt+1)*q-cnt*(cnt+1)/2*p; //cout<<i<<" "<<cnt<<" "<<p<<" "<<q<<" "<<cnt<<" "<<ans<<endl; i+=cnt+1; } printf("%lld\n",ans); } return 0;}
0 0
- UVA 1363(p338)----Joseph's Problem
- UVA - 1363 Joseph's Problem
- UVa 1363 Joseph's Problem
- UVA 1363 - Joseph's Problem(数论)
- uva 1363 - Joseph's Problem(数论)
- uva 1363 Joseph's Problem 等差数列
- UVa 1363 POJ 2800 Joseph's Problem
- uva1363 Joseph's Problem
- ZOJ 2646 Joseph's Problem
- POJ 2800 Joseph's Problem
- hoj1016 Joseph's problem I
- hoj1017 Joseph's problem II
- UVa1363 - Joseph's Problem(数论)
- HOJ 1016 Joseph's problem I
- Poj 2800 Joseph's Problem - 找规律
- 【hoj】1016 Joseph's problem I
- 【hoj】 1017 Joseph's problem II
- POJ 2800 Joseph's Problem(数论)
- BigInteger大整数类高精度
- Hibernate.initialize(Obj)用法
- UVA 1354(p197)----Mobile Computing
- C++ 内存分布,编译与运行阶段探索?(暂时不确定标题)
- jedis 源码阅读三——PipeLine
- UVA 1363(p338)----Joseph's Problem
- 自学vim笔记
- ScaleDrawable的正确打开方式
- Disjoint-Set并查集
- 报告
- UVA 1368(p58)----DNA Consensus String
- Leetcode 160:Intersection of Two Linked Lists
- cpu运行模式切换以及异常处理
- math数学部分