首页 > 其他 > 详细

codeforces round #234B(DIV2) D、Dima and Bacteria

时间:2014-03-10 12:10:55      阅读:386      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
#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 = 0; i < x; ++ i){
        int tmp = cell.first;
        cell.first = cell.second;
        cell.second = n-tmp + 1;
        swap(n,m);
    }
}

void horizontal_rotate(Point &cell, int y){
    if(y==1) cell.second = m - cell.second +1;
}

int main(){
    int x,y,z,p;
    cin >> n >> m >> x >> y >> z >> p;
    x %=4; y %=2; z %= 4;
    int tmp_n = n,tmp_m = m;
    for(int i = 0 ; 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,4-z);
        cout<<cell.first<<" "<<cell.second<<endl;
    }
    return 0;
}
bubuko.com,布布扣

codeforces round #234B(DIV2) D、Dima and Bacteria,布布扣,bubuko.com

codeforces round #234B(DIV2) D、Dima and Bacteria

原文:http://www.cnblogs.com/xiongqiangcs/p/3590753.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!