시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB73363562.500%

문제

Bobby and Betty have a bet. Betty bets Bobby that he cannot roll an S-sided die (having values 1 through S) and obtain a value ≥ R on at least X out of Y rolls. Betty has a variety of dice with different numbers of sides S, and all her dice are fair (for a given die, each side’s outcome is equally likely). In order to observe statistically rare events while still giving Bobby a reason to bet, Betty offers Bobby W to 1 odds on each encounter. For example, suppose Betty bets Bobby 1 bitcoin that he can’t roll at least a 5 on a 6-sided die at least two out of three times; if Bobby does, she would give him 3 times his initial bet (i.e. she would give him 3 bitcoins). Should Bobby take the bet (is his expected return greater than his original bet)?

입력

Input begins with an integer 1 ≤ N ≤ 10 000, representing the number of cases that follow. The next N lines each contain five integers, R, S, X, Y , and W. Their limits are 1 ≤ R ≤ S ≤ 20, 1 ≤ X ≤ Y ≤ 10, and 1 ≤ W ≤ 100.

출력

For each case, output “yes” if Bobby’s expected return is greater than his bet, or “no” otherwise. Bobby is somewhat risk averse and does not bet if his expected return is equal to his bet.

예제 입력 1

2
5 6 2 3 3
5 6 2 3 4

예제 출력 1

no
yes

예제 입력 2

3
2 2 9 10 100
1 2 10 10 1
1 2 10 10 2

예제 출력 2

yes
no
yes

출처

ICPC > Regionals > North America > North America Qualification Contest > ACM-ICPC North America Qualifier 2015 B번

  • 문제를 만든 사람: Chad Mourning