結果

問題 No.338 アンケート機能
ユーザー piconic_Xpiconic_X
提出日時 2016-02-04 22:21:16
言語 OCaml
(5.1.0)
結果
TLE  
実行時間 -
コード長 835 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 21,448 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-04-17 08:32:53
合計ジャッジ時間 3,975 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
12,452 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

let rec hasamiuchi k1 k2 a =
  let left, right = k1 *. a, k2 *. a in
  let cleft = ceil left in
  if cleft <= right then int_of_float (a +. cleft)
  else hasamiuchi k1 k2 (a+.1.)

let k1_k2 la lb =
  let la, lb = float_of_int la, float_of_int lb in
  let lamin, lamax = la -. 0.5, la +. 0.5 in
  let lbmin, lbmax = lb -. 0.5, lb +. 0.5 in
  let k1_la = (100. -. lamax) /. lamax +. 0.0000000001 in
  let k1_lb = lbmin /. (100. -. lbmin) in
  let k2_la = (100. -. lamin) /. lamin in
  let k2_lb = lbmax /. (100. -. lbmax) in
  let k1 = max k1_la k1_lb in
  let k2 = min k2_la k2_lb in
  k1, k2

let () =
  let k1, k2 = Scanf.sscanf (read_line()) ("%i %i") (fun x y -> x, y) in
  if k1 = 0 || k2 = 0 then print_endline "1"
  else
    let k1, k2 = k1_k2 k1 k2 in
    let ans = hasamiuchi k1 k2 1. in
    print_int ans;
    print_endline ""
0