fork download
  1. #pragma GCC optimize ("unroll-loops")
  2. //#pragma GCC optimize ("O3", "omit-frame-pointer","inline")
  3. #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,fma,popcnt,abm,mmx,avx,avx2")
  4.  
  5. #include <bits/stdc++.h>
  6. using namespace std;
  7.  
  8. /***********************************************/
  9. /* Dear online judge:
  10.  * I've read the problem, and tried to solve it.
  11.  * Even if you don't accept my solution, you should respect my effort.
  12.  * I hope my code compiles and gets accepted.
  13.  * ___ __ _______ _______
  14.  * |\ \|\ \ |\ ___ \ |\ ___ \
  15.  * \ \ \/ /|_\ \ __/| \ \ __/|
  16.  * \ \ ___ \\ \ \_|/__\ \ \_|/__
  17.  * \ \ \\ \ \\ \ \_|\ \\ \ \_|\ \
  18.  * \ \__\\ \__\\ \_______\\ \_______\
  19.  * \|__| \|__| \|_______| \|_______|
  20.  */
  21. //const long long mod = 1000000007;
  22. const long long mod = 998244353;
  23. mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
  24.  
  25. const int mxN = 100010;
  26.  
  27. const long double PI = acosl(-1);
  28.  
  29. int main(int argc, char *argv[]) {
  30. #ifdef ONLINE_JUDGE
  31. ios_base::sync_with_stdio(false);
  32. cin.tie(nullptr);
  33. //freopen("input.txt", "r", stdin);
  34. //freopen("output.txt", "w", stdout);
  35. #endif
  36.  
  37. freopen("polygon.in","r",stdin);
  38. srand(time(NULL));
  39. cout << fixed << setprecision(9);
  40.  
  41. int t = 1;
  42. // int Case = 1;
  43. cin >> t;
  44. // t = 10000;
  45. while (t--) {
  46. long double P, X;
  47. cin >> P >> X;
  48. bool f = false;
  49. for (int n = 3; n < 100000; n++) {
  50. long double S = P / n;
  51. long double A = (S * S * n) / (4 * tanl(PI / n));
  52. // cerr << n << ' ' << A << ' ' << A / P << '\n';
  53. if (A > X * P) {
  54. cout << n - 1 << '\n';
  55. f = true;
  56. break;
  57. }
  58. }
  59. if (!f) {
  60. cout << "KEE\n";
  61. }
  62. }
  63. return 0;
  64. }
  65.  
  66. /* stuff you should look for:
  67.  * overflow, array bounds
  68.  * special cases (n=1?)
  69.  * clear arrays
  70.  * DON'T STICK TO ONE APPROACH
  71.  * solve simpler or different variation
  72.  * Solve DP using graph ( \_(-_-)_/ )
  73.  */
  74.  
Success #stdin #stdout 0.06s 5320KB
stdin
Standard input is empty
stdout
KEE