Last night, lots of students from primary school came to our class to study OI. Mark next to me was asked by one of them, "Dude, are you copying codes?" Mark was very angry that time cuz he’s just moving his code from IDE to blog. So he decided to let them take a HARD test (though he failed). Finally that guy apologized and we started upgrading our test so that it could be harder. They’ll take this test this Sunday.
Problem
Interger N and N points in a circle are given. Connect every pair of these points to a edge. There aren’t any 3 edges which shares one point. Please calculate how many pieces of the circle are cut by these edges.
Solution
Let’s consider some cases with smaller Ns. Easy to get
N
ans
1
1
2
2
3
4
4
8
5
16
...
...
Dude, ans=2N−1. Solved.
But actually it’s wrong. These formula JUST right when N∈{1,2,3,4,5,6,10}.
Let’s do some simple problems first.
I. Calculate how many edges are there in the circle;
∵Every 2 points make a edge, and there’re N points, ∴There’re CN2 edges in total.
II. Calculate how many points of intersection of these edges.
It maybe a little difficult, but I think it’s necessary for you guys to think about it.
∵Every 2 edges make a point of intersection, every 2 points make a edge, and there’re N points, ∴There’re N×(N−1)×(N−2)×(N−3)=CN4 points of intersection in total.
Here goes our Euler’s formula in topology. Set a polyhedron which has V vertexes ,F pieces of surface, and E edges. It always meetV−E+F=2 ∴F=E−V+2.
Therefore, the answer is CN2+CN+4+2−1=CN2+CN+4+1. Solved.