結果
| 問題 |
No.2352 Sharpened Knife in Fall
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-06-28 19:28:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 282 ms / 3,000 ms |
| コード長 | 970 bytes |
| コンパイル時間 | 465 ms |
| コンパイル使用メモリ | 48,948 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 12:48:58 |
| 合計ジャッジ時間 | 10,305 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2352.cc: No.2352 Sharpened Knife in Fall - yukicoder
*/
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_K = 100000;
const double PI = acos(-1.0);
const int CNT = 100;
/* typedef */
/* global variables */
double ls[MAX_K];
/* subroutines */
double area(double r, double th) {
return r * r * (th - sin(th) * cos(th));
}
double calc(double r, double s) {
double th0 = 0.0, th1 = PI / 2;
for (int cnt = 0; cnt < CNT; cnt++) {
double th = (th0 + th1) / 2;
if (area(r, th) < s) th0 = th;
else th1 = th;
}
return th0;
}
/* main */
int main() {
int r, k;
scanf("%d%d", &r, &k);
int h = k / 2;
double s = PI * r * r / (k + 1);
for (int i = 0; i < h; i++) {
double th = calc(r, s * (i + 1));
double li = r * cos(th);
ls[i] = -li, ls[k - 1 - i] = li;
}
for (int i = 0; i < k; i++)
printf("%.12lf\n", ls[i]);
return 0;
}
tnakao0123