模拟。

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

记$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. 使用Fiddler伪造服务端返回数据,绕过软件试用期验证

    用过一款和visual studio集成非常好的移动端模拟器,有7天的试用期,可惜不支持国内支付,试用到期了怎么办,不想重装系统. 昨天看有人破解admin page,于是尝试自己动手试试,因为这款模 ...

  2. MvcMovieStore实例 教程

    转原创:MvcMovieStore 实例教程(新概念版:mvc5.0,EF6.01)-初露锋芒 如需转载,请注明出处:http://www.cnblogs.com/DoduNet/ 最近趁业余时间,把 ...

  3. [每日一题] OCP1z0-047 :2013-07-29 视图――别名

    本题的考点是如何创建视图,对于视图的详细知识点,可以参考我的博客: http://blog.csdn.net/guoyjoe/article/details/8614677 好,接下来我们来做测试,先 ...

  4. Nginx 配置基于域名的虚拟

    编辑配置文件 vi /etc/nginx/nginx.conf user    www www; worker_processes  2; error_log  logs/error.log  not ...

  5. MongoDB学习之--安全和认证

    MongoDB学习之--安全和认证 本文主要介绍两部分内容,Mongodb的安全检查配置以及安全认证操作: 虽然确保系统安全是系统管理员的重要工作,但是作为程序员了解其机制也是大有好处的,毕竟不是每个 ...

  6. XLSTransformer生成excel文件

    jxls的使用方法: 1)声明一个XLSTransformer对象,生成方式就是使用new操作符                 XLSTransformer transformer = new XL ...

  7. Mathematics for Computer Graphics

    Mathematics for Computer Graphics 最近严重感觉到数学知识的不足! http://bbs.gameres.com/showthread.asp?threadid=105 ...

  8. FpGrowth算法

    FpGrowth算法 频繁项集与关联规则挖掘(2)--FpGrowth算法   上一篇介绍了关联规则挖掘的一些基本概念和经典的Apriori算法,Aprori算法利用频繁集的两个特性,过滤了很多无关的 ...

  9. Winform程序

    故事的开端是这样的,小白是一个程序员,他确实也是一个小白,目前还在程序员发展的道路上,兢兢业业的小心求学. 有一天,小白接到一个任务,完成一个Winform程序,附加一个功能就是可以读IC卡. 小白终 ...

  10. txt文件保存问题

    今天终于解决了文件的保存问题,之前删除文件,再保存,发现删除的内容还是在文件中. 这是因为保存内容时,是将数组内容一行一行覆盖原来的内容,没有覆盖到的还是保存在文件内. 我用的是CFile类 所以直接 ...