模拟。

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

记$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. windows 常用操作

      资源管理器 资源管理器中进入上一级目录:Alt+向上箭头     常用命令行命令 打开windows服务:services.msc     以管理员身份运行程序 按下Win键,在打开的窗口中输入命 ...

  2. 企业架构研究总结(37)——TOGAF企业连续体和工具之架构资源库及架构工具的选择

    3. 架构资源库 在一个企业,尤其是在一个大型企业中,建设一个成熟的架构往往会产生大量的工作产品.为了很好地管理和利用这些工作产品,企业需要制定一个正式的针对不同类型架构资产的分类方法,并且还需要专门 ...

  3. 理解的javascript自定义事件

    理解的javascript自定义事件 被我拖延了将近一个月的javascript事件模型系列终于迎来了第四篇,也是我计划中的最后一篇,说来太惭愧了,本来计划一到两个星期写完的,谁知中间遇到了很多事情, ...

  4. 分析Sizzle引擎 - 词法解析

    分析Sizzle引擎 - 词法解析 声明:本文为原创文章,如需转载,请注明来源并保留原文链接Aaron,谢谢! 浏览器从下载文档到显示页面的过程是个复杂的过程,这里包含了重绘和重排.各家浏览器引擎的工 ...

  5. js冒泡排序和二分查找

    冒泡排序: var arr=[5,0,-56,900,12,9000,-123,-1000]; var flag=false; for(var i=0;i<arr.length-1;i++){ ...

  6. Android Widget(窗口小部件)

    Android Widget简介 应用程序窗口小部件(Widget)是微型的应用程序视图,它可以被嵌入到其它应用程序中(比如桌面)并接收周期性的更新.你可以通过一个App Widget Provide ...

  7. 一位IT牛人的十年经验之谈

    1.分享第一条经验:“学历代表过去.能力代表现在.学习力代表未来.” 其实这是一个来自国外教育领域的一个研究结果.相信工作过几年.十几年的朋友对这个道理有些体会吧.但我相信这一点也很重要:“重要的道理 ...

  8. Java集合概述、Set集合(HashSet类、LinkedHashSet类、TreeSet类、EnumSet类)

    Java集合概述.Set集合(HashSet类.LinkedHashSet类.TreeSet类.EnumSet类) 1.Java集合概述1)数组可以保存多个对象,但数组长度不可变,一旦在初始化数组时指 ...

  9. 去除scons构建动态库的前缀lib

    如何使用scons构建工程,请参考快速构建C++项目工具Scons,结合Editplus搭建开发环境. 编译SharedLibrary项目的时候,生产的so文件时自动加上lib, 例如: env = ...

  10. convert.c:7:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by

    产生这样的问题主要是因为你使用了某一个函数,却没有引入相应的头文件.这与java中其实是一样的. 例如:在java中,使用某一个工具类,就要导入相应的包.