codeforces668b //Little Artem and Dance// Codeforces Round #348
2024-09-23 17:42:25
题意:2种操作,转动或者奇偶位互换。
不论怎么交换,1的后两位一定是3,3的后两位一定是5。因此只要记录1,2的位置。
//#pragma comment(linker,"/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include <stack>
using namespace std;
const int SZ=,INF=0x7FFFFFFF;
int arr[SZ]; int turn(int x)
{
if((x&)==)return x-;
else
{
return x+;
}
} int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
//for(;scanf("%d",&n)!=EOF;)
{
int n,m;
cin>>n>>m;
int one=,two=;
for(int i=;i<m;++i)
{
int type;
cin>>type;
if(type==)
{
int step;
cin>>step;
one=(one+n+step-)%n+;
two=(two+n+step-)%n+;
}
else
{
one=turn(one);
two=turn(two);
}
}
for(int i=;i<n/;++i)
{
arr[(one+*i-)%n+]=+*i;
arr[(two+*i-)%n+]=+*i;
}
for(int i=;i<=n;++i)
{
if(i!=)cout<<" ";
cout<<arr[i];
}
cout<<endl;
}
return ;
}
最新文章
- 怎么用XMind辅助电商工作
- PHP之session与cookie
- Beanstalk消息队列的实现
- 【POJ 3241】Object Clustering 曼哈顿距离最小生成树
- 新浪微博客户端(47)-在TextView中插入表情
- 教你安装CentOS 6.5如何选择安装包
- JavaScript高级程序设计之元素大小
- iOS学习之Object-C语言类和对象
- Sublime Text—设置浏览器快捷键
- java的真相
- Asp.net: WebForm基础上构建Mvc的方法
- JAVA中的继承和覆盖
- BootStrap——模态框
- PostgreSQL学习手册(常用数据类型)
- 直方图均衡化CImg实现
- datepickerpopup时间限制选取
- Fiddler工具的界面说明
- 【swoole】使用swoole简单实现TCP服务
- composer学习之路01
- FeatureTools