Created
December 7, 2022 02:20
-
-
Save tmoux/c0ead1734858aea427929544a27e2339 to your computer and use it in GitHub Desktop.
Extracted solution from Coq for the problem https://codeforces.com/contest/1519/problem/A
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** val add : int64 -> int64 -> int64 **) | |
let rec add = Int64.add | |
(** val mul : int64 -> int64 -> int64 **) | |
let rec mul = Int64.mul | |
module Nat = | |
struct | |
(** val leb : int64 -> int64 -> bool **) | |
let rec leb = (fun x y -> Int64.compare x y <= 0) | |
end | |
(** val can_distribute : int64 -> int64 -> int64 -> bool **) | |
let can_distribute r b d = | |
if Nat.leb b | |
(mul r (add d ((fun x -> Int64.succ x) Int64.zero))) | |
then Nat.leb r | |
(mul b (add d ((fun x -> Int64.succ x) Int64.zero))) | |
else false | |
let rec solve = function | |
| 0 -> () | |
| n -> let (r,b,d) = Scanf.scanf "%d %d %d\n" (fun a b c -> (Int64.of_int a, Int64.of_int b,Int64.of_int c)) in | |
let ans = if can_distribute r b d then "YES" else "NO" in | |
print_endline ans; | |
solve (n-1) | |
let t = read_int();; | |
solve t;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment