結果

問題 No.2352 Sharpened Knife in Fall
ユーザー laneguelanegue
提出日時 2023-06-16 22:58:28
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 419 ms / 3,000 ms
コード長 441 bytes
コンパイル時間 4,997 ms
コンパイル使用メモリ 210,824 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 21:41:19
合計ジャッジ時間 15,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 417 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 419 ms
4,380 KB
testcase_07 AC 211 ms
4,376 KB
testcase_08 AC 418 ms
4,376 KB
testcase_09 AC 417 ms
4,380 KB
testcase_10 AC 418 ms
4,380 KB
testcase_11 AC 418 ms
4,380 KB
testcase_12 AC 418 ms
4,380 KB
testcase_13 AC 418 ms
4,384 KB
testcase_14 AC 199 ms
4,384 KB
testcase_15 AC 395 ms
4,380 KB
testcase_16 AC 22 ms
4,384 KB
testcase_17 AC 11 ms
4,384 KB
testcase_18 AC 153 ms
4,380 KB
testcase_19 AC 329 ms
4,380 KB
testcase_20 AC 130 ms
4,384 KB
testcase_21 AC 124 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;
void main(){
  auto input = readln.split.to!(int[]);
  auto r = input[0];
  auto k = input[1];
  foreach(n; 0 .. k){
    writefln("%.6f", r * cos(bsearch(PI * (k - n) / (k + 1))));
  }
}

double bsearch(double t){
  double max = PI;
  double min = 0;
  while(max - min > 10.0 ^^ -10){
    double c = (max + min) / 2;
    if(c - cos(c) * sin(c) > t){
      max = c;
    }else{
      min = c;
    }
  }
  return (max + min) / 2;
}
0