UVALive
来源:互联网 发布:python二分法 编辑:程序博客网 时间:2024/06/08 08:15
And Then There Was One
UVALive - 3882n个人围成一圈,第一次删第m个人,然后每数K个删一个人,求最后一个人的编号
#include <iostream>#include <bits/stdc++.h>using namespace std;const int N = 1e6+7;typedef long long LL;int f[N];int n, m;int main(){ int n, m, k; while(scanf("%d %d %d", &n, &k, &m),n!=0&&m!=0&&k!=0) { f[1]=0; for(int i=2;i<=n;i++) f[i]=(f[i-1]+k)%i; int ans=((m-k+1+f[n])%n+n)%n; if(ans==0) ans=n; cout<<ans<<endl; } return 0;}
0 0
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- 使用Calendar创建可视化日历
- 20170419 关于绘制余弦曲线和直线的一些问题
- js语句出现不能建立Date()
- java 基于TCP的Socket网络通信
- c#写winform
- UVALive
- CentOS---网络配置详解
- 代做安卓毕设,代做android毕设!!!!
- C# 之泛型详解
- HTTP报文头Accept和Content-Type总结
- 内存损坏
- 搜索引擎的分片(shard)和副本(replica)机制
- caffe网络配置文件中layer和layers的区别
- Windows+VS2013爆详细Caffe编译安装教程