本文共 885 字,大约阅读时间需要 2 分钟。
先存代码,睡觉去了
代码:
#include#include #include #include using namespace std;const int LCM = 2520;const int MAXN = 100010;int w, h, n, idx;inline bool getTime(int x, int y, int& a, int& b){ int tx1, tx2, ty1, ty2; if(a){ tx1 = (w-x)*LCM/a, tx2 = (-x)*LCM/a; if(tx1<0 && tx2<0) return false; } else{ if(x>=w || x<=0) return false; tx1 = 0, tx2 = 1e9; } if(b){ ty1 = (h-y)*LCM/b, ty2 = (-y)*LCM/b; if(ty1<0 && ty2<0) return false; } else{ if(y>=h || y<=0) return false; ty1 = 0, ty2 = 1e9; } if(tx1 > tx2) swap(tx1, tx2); if(ty1 > ty2) swap(ty1, ty2); if(tx1<0) tx1=0; if(ty1<0) ty1=0; a = max(tx1, ty1); b = min(tx2, ty2); return a 0) maxx = max(++cur, maxx); else --cur; } printf("%d\n", maxx); } return 0;}