#include <iostream>
#include <vector>
#include <algorithm>
#include <utility> using namespace std; typedef pair<int,int> Point; int n,m; void clockwise_rotate(Point &cell, int x){
for(int i = ; i < x; ++ i){
int tmp = cell.first;
cell.first = cell.second;
cell.second = n-tmp + ;
swap(n,m);
}
} void horizontal_rotate(Point &cell, int y){
if(y==) cell.second = m - cell.second +;
} int main(){
int x,y,z,p;
cin >> n >> m >> x >> y >> z >> p;
x %=; y %=; z %= ;
int tmp_n = n,tmp_m = m;
for(int i = ; i < p; ++ i){
n = tmp_n; m =tmp_m;
int cellX,cellY;
cin >> cellX >> cellY;
Point cell = make_pair(cellX,cellY);
clockwise_rotate(cell,x);
horizontal_rotate(cell,y);
clockwise_rotate(cell,-z);
cout<<cell.first<<" "<<cell.second<<endl;
}
return ;
}

codeforces round #234B(DIV2) C Inna and Huge Candy Matrix的更多相关文章

  1. codeforces round #234B(DIV2) A Inna and Choose Options

    #include <iostream> #include <string> #include <vector> using namespace std; ; ,,, ...

  2. codeforces round #234B(DIV2) B Inna and New Matrix of Candies

    #include <iostream> #include <vector> #include <string> #include <algorithm> ...

  3. codeforces C. Inna and Huge Candy Matrix

    http://codeforces.com/problemset/problem/400/C 题意:给你一个n*m的矩阵,然后在矩阵中有p个糖果,给你每个糖果的初始位置,然后经过x次顺时针反转,y次旋 ...

  4. codeforces C. Inna and Huge Candy Matrix 解题报告

    题目链接:http://codeforces.com/problemset/problem/400/C 题目意思:给出一个n行m列的矩阵,问经过 x 次clockwise,y 次 horizontal ...

  5. codeforces 400 C Inna and Huge Candy Matrix【模拟】

    题意:给出一个矩形的三种操作,顺时针旋转,逆时针旋转,对称,给出原始坐标,再给出操作数,问最后得到的坐标 画一下模拟一下操作就可以找到规律了 #include<iostream> #inc ...

  6. Codeforces Round #539 div2

    Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...

  7. 【前行】◇第3站◇ Codeforces Round #512 Div2

    [第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...

  8. Codeforces Round#320 Div2 解题报告

    Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...

  9. Codeforces Round #564(div2)

    Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...

随机推荐

  1. JS中级 - 02:表单、表格

    getElementsByTagName() getElementsByTagName() 方法可返回带有指定标签名的对象的集合. getElementsByClassName() 返回文档中所有指定 ...

  2. Eclipse 控制console

    http://blog.csdn.net/leidengyan/article/details/5686691

  3. Linux SNMP oid

    http://www.debianadmin.com/linux-snmp-oids-for-cpumemory-and-disk-statistics.html

  4. 移除IIS默认的响应头(转载)

    转载地址:http://www.cnblogs.com/dudu/p/iis-remove-response-readers.html 在IIS+ASP.NET的运行环境,默认情况下会输出以下的响应头 ...

  5. 注解:【有连接表的】Hibernate单向1->N关联

    Person与Address关联:单向1->N,[有连接表的] Person.java package org.crazyit.app.domain; import java.util.Hash ...

  6. 报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用localhost

    执行如下命令报错 mysql -uroot -h${hostIp} -p Enter password:********* ERROR (HY000): Host '$hostIp' is not a ...

  7. hdu 3001(状压dp, 3进制)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3001 由于本题中一个点最多能够访问2次,由此可以联想到3进制; visited[i][j]表示在状态i ...

  8. T-SQL中只截取日期的日期部分和日期的时间部分

    SQL Server 中截取日期的日期部分: ),) SQL Server 中截取日期的时间部分: ),) ),DD_133,)

  9. scrollview嵌套listview 滑动事件冲突的解决方法

    listView.setOnTouchListener(new View.OnTouchListener() {                            @Override       ...

  10. hdu 1069 Monkey and Banana

    Monkey and Banana Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...