好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CodeforcesRound#280(Div.2)_html/css_WEB-ITnose

这场题简单的令人吃惊

然后x方向你从0模拟走个n步,得到一个x坐标序列

y坐标也这么干

两个序列。都是可以循环的

然后你选择从某个点(x0,y0)出发

无非就是对两个序列,x序列的从x0开始,y序列从y0开始,各自走个n步,看有哪些点是符合题目要求的

再一看,发现无非就是看两个序列的相对位置了。

对所有给出的点, 算出其对应的 两个序列的相对位置,最后统计下即可


#include  #include  #include  #include  #include  #include #include  #define MAXN 55555#define MAXM 222222#define INF 1000000001using namespace std;int posx[1111111], posy[1111111];int n, m, dx, dy;int x[111111], y[111111];int num[1111111];int main() {    scanf("%d%d%d%d", &n, &m, &dx, &dy);    int now = 0;    int ind = 0;    while(posx[now] == 0) {        posx[now] = ++ind;        now = (now + dx) % n;    }    now = 0, ind = 0;    while(posy[now] == 0) {        posy[now] = ++ind;        now = (now + dy) % n;    }    int mx = 0, p = 0;    for(int i = 0; i   mx) {            mx = num[t];            p = t;        }    }    for(int i = 0; i  

查看更多关于CodeforcesRound#280(Div.2)_html/css_WEB-ITnose的详细内容...

  阅读:32次