main.ml (767B)
1 let readInt () = 2 Scanf.scanf " %d" (fun x -> x) 3 in 4 let readInts n = 5 let arr = Array.make n 0 in 6 let rec acc idx = 7 if idx >= n then () else (arr.(idx) <- readInt (); acc (idx+1)) 8 in acc 0; arr 9 in 10 let angleFromEyeLevel height distance = 11 atan ((float_of_int (height - 6)) /. (float_of_int (distance))) 12 in 13 let solve nums = 14 let rec acc idx best = 15 if idx >= (Array.length nums) then 0 else 16 let currentAngle = angleFromEyeLevel nums.(idx) ((idx * 110) + 100) in 17 if currentAngle > best then 18 1 + (acc (idx+1) currentAngle) 19 else acc (idx+1) best 20 in acc 0 0. 21 in 22 let n = readInt () in 23 let nums = readInts n in 24 print_int (solve nums); print_newline ()