POJ 3517 找规律、递推
来源:互联网 发布:人工智能 在线课程 编辑:程序博客网 时间:2024/05/22 00:14
#include"iostream"#include"stdio.h"#include"vector"#include"functional"#include"string"#include"cstring"#include"algorithm"#include"queue"#include"set"#define f1 cout<<"fuck1"<<endl;#define f2 cout<<"fuck2"<<endl;using namespace std;typedef pair<int,int> pii;typedef vector<int> vi;const int maxn=20000;int main(){ //freopen("b.in","r",stdin); // freopen("b.out","w",stdout); int f[maxn]; int n,m,k; while(cin>>n>>k>>m&&(n+k+m)) { f[1]=0; //从0开始 然后找规律 for(int i=2;i<=n;i++) f[i]=(f[i-1]+k)%i; int ans=(f[n]+m-k)%n; //m-k是距离 加上从0开始算出来的最后一个人的位置然后对n取余因为k可能很大 if(ans<0) ans+=n; cout<<ans+1<<endl; //结果加一 }}
0 0
- POJ 3517 找规律、递推
- 找规律 递推
- HDU2058 找规律+递推
- poj 2440 DNA (dp|递推|找规律|矩阵乘法)
- poj 2800 找规律
- 关于递推的程序,关键是找规律!!
- nyist 982 Triangle Counting(数学题,找规律 递推)
- UVa 1647 - Computer Transformation(找规律+递推)
- HDOJ-2050(递推,找规律)(折线分割平面)
- F(k)<(维护+枚举)\(找规律+递推+枚举)>
- 递推:Number Sequence(mod找规律)
- HDU 2050:折线分割平面(找规律,递推)
- CSU 1972: 大梵天的恩赐 <递推,找规律>
- UVAlive-6577 Binary Tree(递推+找规律)
- Maximum Value Problem FZU 2037 找规律 递推
- //数学基础-推公式找规律
- POJ 1082 博弈推规律
- POJ 1068(找规律)
- 2016 USP Try-outs Gym101064
- POJ 1386 欧拉回路
- 判断nan的方法
- 使用环境变量打开.exe文件
- GIT命令整理
- POJ 3517 找规律、递推
- 解决内存溢出问题:java.lang.OutOfMemoryError
- [leetcode] 105. Construct Binary Tree from Preorder and Inorder Traversal
- 不要再退缩再浪费
- c++数组的基础知识
- [leetcode] 200. Number of Islands
- 占位
- 占位
- 占位