Codeforces Beta Round #32
轉載請註明出處,謝謝http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlove
時運不濟,繼續水CF。。。
A:Reconnaissance
列舉
B:Borze
模擬
C:Flea
先算出最多可以多少個,然後 統計一下有多少個位置
LL n , m , s;
int main () {
#ifndef ONLINE_JUDGE
freopen ("input.txt" , "r" , stdin);
// freopen ("output.txt" , "w" , stdout);
#endif
cin >> n >> m >> s;
LL w = (n - 1) / s;
LL h = (m - 1) / s;
LL cnt = (w + 1) * (h + 1);
LL a = min (s - 1 , (m - 1) % s);
LL b = min (s - 1 , (n - 1) % s);
cout << (a + 1) * (b + 1) * cnt << endl;
return 0;
}
D:Constellation
列舉每個位置,列舉半徑,然後排序,輸出。。
E:Hide and seek
簡單幾何
首先判斷能否直接看到目標,判斷條件是不和牆相交 且 (不和鏡子相交或者和鏡子平行)
然後再判斷能否反射看到,做目標點關於鏡子的反射點,然後連線源點和反射點,判斷與鏡子是否有交點,否則不可達。
然後再判斷下入射光線和反射光線是否會和牆相交。
const double eps = 1e-8;
int dcmp (double d) {
return d < -eps ? -1 : d > eps;
}
struct Point {
double x , y;
Point () {}
Point (double _x , double _y):x(_x),y(_y){}
void input () {
scanf ("%lf %lf" , &x , &y);
}
inline Point operator - (const Point &p) const {
return Point (x - p.x , y - p.y);
}
inline Point operator + (const Point &p) const {
return Point (x + p.x , y + p.y);
}
inline double operator * (const Point &p) const {
return x * p.y - y * p.x;
}
inline double operator / (const Point &p) const {
return x * p.x + y * p.y;
}
inline Point operator * (const double d) const {
return Point (x * d , y * d);
}
inline Point operator / (const double d) const {
return Point (x / d , y / d);
}
inline Point turnLeft () {
return Point (-y , x);
}
}s , e;
struct Line {
Point a , b;
Line () {}
Line (Point _a , Point _b):a(_a),b(_b){}
void input () {
a.input ();
b.input ();
}
inline double operator * (const Point &p) const {
return (b - a) * (p - a);
}
inline double operator / (const Point &p) const {
return (p - a) / (p - b);
}
inline int SegCrossSeg (const Line &v) {
int d1 = dcmp ((*this) * v.a);
int d2 = dcmp ((*this) * v.b);
int d3 = dcmp (v * a);
int d4 = dcmp (v * b);
if ((d1 ^ d2) == -2 && (d3 ^ d4) == -2) return 2;
return ((d1 == 0 && dcmp ((*this) / v.a) <= 0)
|| (d2 == 0 && dcmp ((*this) / v.b) <= 0)
|| (d3 == 0 && dcmp (v / a) <= 0)
|| (d4 == 0 && dcmp (v / b) <= 0));
}
inline bool parallel (Line v) {
return !dcmp ((b - a) * (v.b - v.a));
}
inline Point CrossPoint (const Line &v) {
double s1 = v * a , s2 = v * b;
return (a * s2 - b * s1) / (s2 - s1);
}
inline Point PointToLine (const Point &p) {
return CrossPoint (Line (p , p + (a - b).turnLeft ()));
}
inline Point SymPoint (const Point &p) {
return PointToLine (p) * 2 - p;
}
}wall , mirror;
int main () {
#ifndef ONLINE_JUDGE
freopen ("input.txt" , "r" , stdin);
// freopen ("output.txt" , "w" , stdout);
#endif
s.input ();e.input ();
wall.input ();mirror.input ();
if (wall.SegCrossSeg (Line (s , e)) == 0 ) {
if (mirror.SegCrossSeg (Line (s , e)) == 0 || mirror.parallel (Line (s , e))) {
puts ("YES");
return 0;
}
}
Point t = mirror.SymPoint (e);
if (mirror.SegCrossSeg (Line (s , t)) >= 1) {
Point p = mirror.CrossPoint (Line (s , t));
if (wall.SegCrossSeg (Line (s , p)) == 0 && wall.SegCrossSeg (Line (p , e)) == 0) {
puts ("YES");
return 0;
}
}
puts ("NO");
return 0;
}
相關文章
- Codeforces Beta Round #23
- Educational Codeforces Round 32
- Codeforces Beta Round #14 (Div. 2)
- Codeforces Beta Round #76 (Div. 1 Only) A. Frames
- [CF77] Codeforces Beta Round 69 (Div. 1 Only) A~E 題解
- Codeforces Beta Round #6 (Div. 2 Only) C. Alice, Bob and Chocolate 水題
- Codeforces Round #174
- Codeforces Round #170
- Codeforces Round 955
- Codeforces Global Round 13
- Codeforces Round #180
- Codeforces Global Round 26
- Codeforces Global Round 27
- Codeforces Educational Round#98 A
- Educational Codeforces Round 1 Tutorial
- Codeforces Global Round 26 (A - D)
- Educational Codeforces Round 163
- Codeforces Round 962(Div .3)
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- 【CodeForces訓練記錄】Codeforces Global Round 27
- Codeforces Round #639 (Div. 2)
- Uncowed Forces Codeforces Round #334
- Codeforces Round #541 (Div. 2)
- Codeforces Round #690 (Div. 3)
- Codeforces Round #682 (Div. 2)
- Codeforces Round #678 (Div. 2)
- 【題解】Educational Codeforces Round 82
- Codeforces Round #747 (Div. 2)
- Codeforces Round #673 (Div. 2)
- Codeforces Round #672 (Div. 2)
- Codeforces Round #469 C A. Zebras
- Codeforces Round #399 (A,B,C)
- Codeforces Round #448 (Div. 2) A
- Codeforces Round #217 (Div. 2)
- Codeforces Round #217前三題
- Codeforces Round #256 (Div. 2)
- Codeforces Round #259 (Div. 2)
- Codeforces Round #257 (Div. 2)