m******u 发帖数: 12400 | 1 When squirrels get together for a party, they like to have cigars. A
squirrel party is successful when the number of cigars is between 40 and 60,
inclusive. Unless it is the weekend, in which case there is no upper bound
on the number of cigars. Return true if the party with the given values is
successful, or false otherwise.
Enter number of cigars:
60
Is it a weekend?Enter (true/false):
true
Party successful:true
Enter number of cigars:
40
Is it a weekend?Enter (true/false):
false
Party successful:true | m******u 发帖数: 12400 | | n*******e 发帖数: 4894 | 3 if (isWeekend && number>= 40){
return true;
} else if (!isWeekend && 40 <=number<=60){
return true;
} else {
return false;
}
60,
bound
【在 m******u 的大作中提到】 : When squirrels get together for a party, they like to have cigars. A : squirrel party is successful when the number of cigars is between 40 and 60, : inclusive. Unless it is the weekend, in which case there is no upper bound : on the number of cigars. Return true if the party with the given values is : successful, or false otherwise. : Enter number of cigars: : 60 : Is it a weekend?Enter (true/false): : true : Party successful:true
| m******u 发帖数: 12400 | | m******u 发帖数: 12400 | |
|