codeforces 400 C Inna and Huge Candy Matrix【類比】

來源:互聯網
上載者:User

標籤:

題意:給出一個矩形的三種操作,順時針旋轉,逆時針旋轉,對稱,給出原始座標,再給出運算元,問最後得到的座標

畫一下類比一下操作就可以找到規律了

 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【類比】

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.