Algorithm
problem Link : https://www.codechef.com/problems/AUDIBLE
Problem
Chef's dog binary hears frequencies starting from Hertz to Hertz (both inclusive).
If Chef's commands have a frequency of Hertz, find whether binary can hear them or not.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of a single integer - the frequency of Chef's commands in Hertz.
Output Format
For each test case, output on a new line YES
, if binary can hear Chef's commands. Otherwise, print NO
.
The output is case-insensitive. Thus, the strings YES
, yes
, yeS
, and Yes
are all considered the same.
Constraints
Sample 1:
5 42 67 402 45000 45005
NO YES YES YES NO
Explanation:
Test case : Chef's command has a frequency of Hertz which is less than . Thus, it would not be audible to binary.
Test case : Chef's command has a frequency of Hertz which lies in the range . Thus, it would be audible to binary.
Test case : Chef's command has a frequency of Hertz which lies in the range . Thus, it would be audible to binary.
Test case : Chef's command has a frequency of Hertz which lies in the range . Thus, it would be audible to binary.
Test case : Chef's command has a frequency of Hertz which is greater than . Thus, it would not be audible to binary.
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h> int main(void) { int t,hz; scanf("%d",&t); while(t--) { scanf("%d",&hz); if(hz>=67 && hz<=45000) printf("YES\n"); else printf("NO\n">; } return 0; }Copy The Code & Try With Live Editor
Input
42
67
402
45000
45005
Output
YES
YES
YES
NO<
Demonstration
CodeChef solution AUDIBLE - Audible Range CodeChef solution in C,C++