結果
| 問題 |
No.2352 Sharpened Knife in Fall
|
| コンテスト | |
| ユーザー |
hikikomori
|
| 提出日時 | 2023-04-11 18:48:20 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 863 ms / 3,000 ms |
| コード長 | 2,010 bytes |
| コンパイル時間 | 5,172 ms |
| コンパイル使用メモリ | 314,976 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 12:51:30 |
| 合計ジャッジ時間 | 21,187 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<ll>>;
using vi = vector<int>;
using vl = vector<long>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvll = vector<vll>;
using vs = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<long long, long long>;
using vpll = vector<pll>;
using mint = modint1000000007;
const long double EPS = 1e-18;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); i++)
#define rep(i, n) for (ll i = (0); i < (ll)(n); i++)
#define rrep(i, n) for (ll i = (1); i < (ll)(n + 1); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define rrepd(i, n) for (ll i = n; i >= 1; i--)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) (a <= x && x < b)
#define INIT \
std::ios::sync_with_stdio(false); \
std::cin.tie(0);
template <class T>
inline T CHMAX(T& a, const T b) {
return a = (a < b) ? b : a;
}
template <class T>
inline T CHMIN(T& a, const T b) {
return a = (a > b) ? b : a;
}
ld f(ld x) { return 1.0 * (2.0 * x - sinl(2.0 * x)); }
ld nibu(ld S) {
ld ng = PI / 2.0;
ld ok = 0.0;
while (abs(ok - ng) > EPS) {
ld mid = (ok + ng) / 2.0;
if (S >= f(mid)) {
ok = mid;
} else {
ng = mid;
}
}
return ok;
}
int main() {
ll R, K;
cin >> R >> K;
vector<ld> ans;
ld cut = 1.0 / (K + 1);
rrep(i, K / 2) {
ld menseki = 2.0 * PI * cut * i;
ld kaku = nibu(menseki);
ans.push_back(1.0 * R * cosl(kaku));
}
ll n = ans.size();
rep(i, n) { ans.push_back(-1.0 * ans[i]); }
if (K % 2) {
ans.push_back((ld)0.0);
}
sort(ALL(ans));
for (auto x : ans) {
cout << setprecision(12) << x << endl;
}
return 0;
}
hikikomori