UVa 1394 - And Then There Was One(约瑟夫数论)
来源:互联网 发布:淘宝申请介入会退款吗 编辑:程序博客网 时间:2024/06/05 22:36
数论问题,
递推公式为
#include<cstdio>const int maxn=10010;int f[maxn];int main(){ int n,m; while(~scanf("%d%d",&n,&m)&&n){ f[1]=0; for(int i=2;i<=n;++i) f[i]=(f[i-1]+m)%i; int ans=(1+f[n])%n; if(ans<=0) ans+=n; printf("%d\n",ans); } return 0;}
0 0
- UVa 1394 - And Then There Was One(约瑟夫数论)
- uva 1394 - And Then There Was One(约瑟夫环)
- UVA-1394-And Then There Was One(约瑟夫环)
- UVA 1394 And Then There Was One(约瑟夫环变形)
- uva 1394 - And Then There Was One
- UVA 1394 And Then There Was One
- UVa 1394: And Then There Was One
- UVa:1394 And Then There Was One
- UVA - 1394 And Then There Was One
- uva live 3882 And Then There Was One 约瑟夫环
- And Then There Was One----约瑟夫环
- UVA 1394 - And Then There Was One(dp+约瑟夫环变形)
- poj3517 And Then There Was One(约瑟夫环)
- POJ 3517 And Then There Was One(约瑟夫环)
- UVA 1394/POJ 3517 And Then There Was One
- uva 1394 And Then There Was One 递推
- 1394 - And Then There Was One(约瑟夫问题变形)DP
- UVa 3882 And Then There Was One(stl+有技巧的模拟||数学方法+约瑟夫问题)
- CAS——手写第一步:HTML控件与Web服务器控件
- 也谈VC中ModifyStyle&ModifyStyleEx无法改变控件的Style)
- 裸机驱动模板
- vc6.0在win8或8.1下“打开文件”功能不用用的解决办法
- 万网企业邮箱拒信常规问题对照表
- UVa 1394 - And Then There Was One(约瑟夫数论)
- 桥 Gym100712H Bridges
- SORBS的DUHL申诉移除过程图解
- ZOJ1709/POJ1562 油田问题/搜索/DFS
- poj解题报告——1579
- java的IO框架总结
- 高斯函数
- #1122 : 二分图二•二分图最大匹配之匈牙利算法
- Library用法&SlidingMenu简介