码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-05-05 15:54:30      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

题意:给出一个矩形的三种操作,顺时针旋转,逆时针旋转,对称,给出原始坐标,再给出操作数,问最后得到的坐标

画一下模拟一下操作就可以找到规律了

技术分享
 1 #include<iostream>  
 2 #include<cstdio>  
 3 #include<cstring> 
 4 #include <cmath> 
 5 #include<stack>
 6 #include<vector>
 7 #include<map> 
 8 #include<set>
 9 #include<queue> 
10 #include<algorithm>  
11 using namespace std;
12 
13 #define foreach(i,c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
14 
15 typedef long long LL;
16 const int INF = (1<<30)-1;
17 const int mod=1000000007;
18 const int maxn=100005;
19 
20 int main(){
21     int N,M,x,y,z,p;
22     cin>>N>>M>>x>>y>>z>>p;
23     x=x%4;y=y%2;z=z%4;
24     while(p--){
25         int n,m;
26         n=N;m=M;
27         int u,v;
28         cin>>u>>v;
29         for(int i=0;i<x;i++){
30             swap(u,v);
31             swap(n,m);
32             v=m+1-v;
33         }
34         if(y) v=m+1-v;
35         for(int i=0;i<z;i++){
36             swap(u,v);
37             swap(n,m);
38             u=n+1-u;            
39         }
40         printf("%d %d\n",u,v);        
41     }
42     return 0;
43 }
View Code

 

 

 

 

 

 

 

 

 

 

 

 

 

 

大中午的做模拟---好醒觉啊

----- 加油---go000000000000000

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

标签:

原文地址:http://www.cnblogs.com/wuyuewoniu/p/4478992.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!