您的位置:首页 > 其它

codeforces--280--

2014-12-02 03:42 337 查看
其实本场 很水 = =B C都犯了sb错误挂了..

B挂在 自己代码里没有考虑N=1的情况

C挂在 在Int向LL进行强制转换的时候 先溢出了 以后应该这样写 1LL * x * y 或者直接将x y定义为LL

D E porker帮忙= =解释 明天给 睡觉了 3点半了 我擦

B

#include <iostream>
#include <cstring>
using namespace std;

int table[1000010];
int counts[1000010];

int main() {
int n, m, dx, dy;
cin >> n >> m >> dx >> dy;
int y = 0;
for (int i = 0; i < n; i++) {
table[n - y] = i;
y += dy;
y %= n;
}
table[0] = table
;
memset(counts, 0, sizeof(counts));
int result = 0;
long long locx, locy;
while (m--) {
long long x, y;
cin >> x >> y;
long long k = table[y];
long long newx = (x + k * dx) % n;
counts[newx]++;
if (counts[newx] > result) {
result = counts[newx];
locx = x;
locy = y;
}
}
cout << locx << " " << locy << endl;
}


View Code

today:

  where'd you go
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: