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
View Code
today:
where'd you go
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
相关文章推荐
- CodeForces - 280D k-Maximum Subsequence Sum 线段树模拟费用流操作
- Codeforces 280 DIV2
- codeforces 280,281(Round #172)题解
- Codeforces 280 C. Game on Tree (概率与期望)
- 【Codeforces】 487A Fight the Monster
- codeforces 620D D. Professor GukiZ and Two Arrays
- CodeForces 371C Hamburgers
- Codeforces 669C Little Artem and Matrix【思维+暴力】
- Codeforces 330E Graph Reconstruction【随机化算法】Get it!
- Codeforces 887D - Ratings and Reality Shows
- CodeForces 490F Treeland Tour
- codeforces 611C New Year and Domino DP预处理+部分和思想
- Codeforces 373C:Counting Kangaroos is Fun(二分+贪心)
- codeforces 766 C Mahmoud and a Message [基础DP]【动态规划】
- Codeforces-557D Vitaly and Cycle(二分图染色)
- CodeForces 431 D.Random Task(组合数学)
- Codeforces 489E Hiking(普通01分数规划加DP)
- Codeforces 118D Caesar's Legions (dp)
- CodeForces 621B Wet Shark and Bishops
- Codeforces_766_D_(并查集)