[Solved] Instagram STARTERS 71 CodeChef

Chef categorises an instagram account as spam, if, the following count of the account is more than 1010 times the count of followers.

Given the following and follower count of an account as XX and YY respectively, find whether it is a spam account.

Input Format
  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of two space-separated integers XX and YY β€” the following and follower count of an account, respectively.
Output Format

For each test case, output on a new line, YES, if the account is spam and NO otherwise.

You may print each character of the string in uppercase or lowercase. For example, the strings YESyesYes and yES are identical.

Constraints
[Solved] Instagram STARTERS 71 CodeChef
Sample 1:

Input

4
1 10
10 1
11 1
97 7

Output

NO
NO
YES
YES
Explanation:

Test case 11: The following count is 11 while the follower count is 1010. Since the following count is not more than 1010 times the follower count, the account is not spam.

Test case 22: The following count is 1010 while the follower count is 11. Since the following count is not more than 1010 times the follower count, the account is not spam.

Test case 33: The following count is 1111 while the follower count is 11. Since the following count is more than 1010 times the follower count, the account is spam.

Test case 44: The following count is 9797 while the follower count is 77. Since the following count is more than 1010 times the follower count, the account is spam.

Solution

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if(x>y*10){
                //sauravhathi
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
	}
}

Happy Learning – If you require any further information, feel free to contact me.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

πŸ“Œ Nodejs and Android 😎
πŸ“Œ Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *