模拟。

每个奇数走的步长都是一样的,每个偶数走的步长也是一样的。

记$num1$表示奇数走的步数,$num2$表示偶数走的步数。每次操作更新一下$num1$,$num2$。最后输出。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c=getchar(); x=;
while(!isdigit(c)) c=getchar();
while(isdigit(c)) {x=x*+c-''; c=getchar();}
} bool f;
int n,q,num1,num2;
int ans[]; int M(int x)
{
if(x>=) return x%n;
int y=-x; int p=y/n+;
return (x+n*p)%n;
} int main()
{
scanf("%d%d",&n,&q); f=;
for(int i=;i<=q;i++)
{
int op; scanf("%d",&op);
if(op==)
{
int x; scanf("%d",&x);
num1=M(num1+x), num2=M(num2+x);
if(x%!=) f=f^;
}
else
{
if(f==) num2=M(num2+), num1=M(num1-);
else num1=M(num1+), num2=M(num2-);
f=f^;
}
} for(int i=;i<=n;i++)
{
int pos;
if(i%==) pos=(i+num2)%n;
else pos=(i+num1)%n; if(pos==) pos=n;
ans[pos]=i;
}
for(int i=;i<=n;i++) printf("%d ",ans[i]);
printf("\n");
return ;
}

CodeForces 669D Little Artem and Dance的更多相关文章

  1. Codeforces 669D Little Artem and Dance (胡搞 + 脑洞)

    题目链接: Codeforces 669D Little Artem and Dance 题目描述: 给一个从1到n的连续序列,有两种操作: 1:序列整体向后移动x个位置, 2:序列中相邻的奇偶位置互 ...

  2. CodeForces - 669D Little Artem and Dance 想法题 多余操作

    http://codeforces.com/problemset/problem/669/D 题意:n个数1~N围成一个圈.q个操作包括操作1:输入x, 所有数右移x.操作2:1,2位置上的数(swa ...

  3. CodeForces 668B Little Artem and Dance

    B. Little Artem and Dance time limit per test 2 second memory limit per test 256 megabytes input sta ...

  4. codeforces 669D D. Little Artem and Dance(乱搞题)

    题目链接: D. Little Artem and Dance time limit per test 2 seconds memory limit per test 256 megabytes in ...

  5. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟

    D. Little Artem and Dance 题目连接: http://www.codeforces.com/contest/669/problem/D Description Little A ...

  6. D. Little Artem and Dance

    题目链接:http://codeforces.com/problemset/problem/669/D D. Little Artem and Dance time limit per test 2 ...

  7. D. Little Artem and Dance(带环模拟 + 规律)

    D. Little Artem and Dance Little Artem is fond of dancing. Most of all dances Artem likes rueda - Cu ...

  8. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance

    题目链接: http://codeforces.com/contest/669/problem/D 题意: 给你一个初始序列:1,2,3,...,n. 现在有两种操作: 1.循环左移,循环右移. 2. ...

  9. codeforces668b //Little Artem and Dance// Codeforces Round #348

    题意:2种操作,转动或者奇偶位互换. 不论怎么交换,1的后两位一定是3,3的后两位一定是5.因此只要记录1,2的位置. //#pragma comment(linker,"/STACK:10 ...

随机推荐

  1. SQLSERVER一些公用DLL

    SQLSERVER一些公用DLL的作用解释   SQLSERVER一些公用DLL的作用解释 如果你的SQLSERVER安装在C盘的话,下面的路径就是相应SQLSERVER版本的公用DLL的存放路径 S ...

  2. 统计学习方法(三)——K近邻法

    /*先把标题给写了.这样就能经常提醒自己*/ 1. k近邻算法 k临近算法的过程,即对一个新的样本,找到特征空间中与其最近的k个样本,这k个样本多数属于某个类,就把这个新的样本也归为这个类. 算法  ...

  3. Bootstrap3入门

    Bootstrap3学习第一轮(入门) 前言 在上一节中http://www.cnblogs.com/aehyok/p/3381651.html主要是简单的介绍了一下Bootstrap.从http:/ ...

  4. ARM备忘

    mov: move sub: subtract cmp: compare cmpls: ls--->lower or same, le--->less or equal, hi---> ...

  5. 判断UA这种事不能说的太明。

    [微博] Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.30 (KHTML, l ...

  6. Oracle中如何删除某个用户下的所有数据的方法

    win+R打开cmd 使用dba身份登录: sqlplus sys/sys@orcl as sysdba; 然后使用dba身份删除某个用户: drop user apptdm_9y cascade;

  7. cubie两种固定MAC地址的方法

    1.修改 /etc/init.d/networking 配置文件 在(a)代码的后面添加上(b)这段代码 (a)case "$1" in start) :5e #MAC地址可改 2 ...

  8. iOS多线程的初步研究3

    iOS多线程的初步研究(三) 弄清楚NSRunLoop确实需要花时间,这个类的概念和模式似乎是Apple的平台独有(iOS+MacOSX),很难彻底搞懂(iOS没开源,呜呜). 官网的解释是说run ...

  9. JavaEE:Cookie和Session

    Cookie是客户端技术,程序把每个用户的数据以cookie的形式写给用户各自的浏览器.当用户使用浏览器再去访问服务器中的web资源时,就会带着各自的数据去.这样web资源处理的就是用户各自的数据了. ...

  10. 迷你MVVM框架 avalonjs 0.82发布

    迷你MVVM框架 avalonjs 0.82发布 本版本最大的改进是启用全新的parser. parser是用于干什么的?在视图中,我们通过绑定属性实现双向绑定,比如ms-text="fir ...