Luo Gu problem solution 2165 [AHOI2009] flight chess

This konjac again made a solution to a problem,

See this topic, konjac just start to push this formula. .

Ah, the arc length can be launched chord (l = 2 * r * cos (90 * l / (r * Π));

Then compare the pieces of the square and the square of chord length to diameter.

It QwQ

### The above is purely in vain, back to the topic

I wrote above that in the algorithm, and then struggling to tune not the time.

I began to suspect I was not thinking there is a problem.

It turns out that indeed seems to have a problem;

## The above is purely in vain, back to the topic +1

We think about what the nature of the rectangle:

Four corners are right angles.

Ah, if in a circle, what kind of angle is a right angle.

Ah, the diameter corresponding to the circumferential angle is a right angle certainly.

I did not say it must be at right angles to the corresponding diameter.

Well, it's because the angle is a right angle.

Then the two sides are certainly diameter.

You do not like it, huh?

On the code:

```cpp
#include<bits/stdc++.h>
using namespace std;

#define maxn 50
int n, a[maxn], s[maxn], ans, sum;

main int ()
{
Scanf ( "% D", & n-); // input
for (int I =. 1; I <= n-; I ++)
{
Scanf ( "% D", A & [I]); // input
s [i] = s [i - 1] + a [i]; // prefix handling and
sum + = a [i]; // sum girth
}
for (int I =. 1; I <= n-; I ++)
for (int I = J +. 1; J <= n-; J ++)
IF (S [J] - S [I] == SUM / 2) is the diameter judgment is not //
++ ans ;
the printf ( "% D", ANS * (ANS -. 1) / 2);
return 0;
}
`` `

Guess you like

Origin www.cnblogs.com/Flash-plus/p/11769359.html