Problem
Chef has to give a test which has a total of question, each question carries marks for a correct answer and for an incorrect answer. Chef decided to attempt all the questions. It is known that Chef got questions correct and the rest of them incorrect. For Chef to pass the course he must score at least marks.
Will Chef be able to pass the exam or not?
Input Format
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, three integers .
Output Format
For each test case output "PASS"
if Chef passes the exam and "FAIL"
if Chef fails the exam.
You may print each character of the string in uppercase or lowercase (for example, the strings "pAas", "pass", "Pass" and "PASS" will all be treated as identical).
Constraints
Sample 1:
3 5 2 3 5 2 4 4 0 0
PASS FAIL FAIL
Explanation:
Test case : Chef gets questions correct giving him marks and since he got questions incorrect so he faces a penalty of . So Chef's final score is and the passing marks are also , so he passes the exam :)
Test case : Chef's total marks are and since the passing marks are , Chef fails the test :(
Test case : Chef got all the problems wrong and thus his total score is . Since the passing marks are , Chef fails the exam :(
Program :
/* 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
int n,x,p,t,a,b;
Scanner sc=new Scanner(System.in);
t=sc.nextInt();
while(t-->0){
n=sc.nextInt();
x=sc.nextInt();
p=sc.nextInt();
a=3*x;
b=(n-x)*(-1);
if(a+b>=p)
System.out.println("PASS");
else
System.out.println("FAIL");
}
}
}
0 Comments