Posts

Showing posts from July, 2023

RCB AND PLAYOFFS solution in C++ language.- Codechef

    RCB AND PLAYOFFS Problem Code:  RCBPLAY Team RCB has earned  � X  points in the games it has played so far in this year's IPL. To qualify for the playoffs they must earn  at least  a total of  � Y  points. They currently have  � Z  games left, in each game they earn  2 2  points for a win,  1 1  point for a draw, and no points for a loss. Is it possible for RCB to qualify for the playoffs this year? Input Format First line will contain  � T , number of testcases. Then the testcases follow. Each testcase contains of a single line of input, three integers  � , � , � X , Y , Z . Output Format For each test case, output in one line YES if it is possible for RCB to qualify for the playoffs, or NO if it is not possible to do so. Output is case insensitive, which means that "yes", "Yes", "YEs", "no", "nO" - all such strings will be acceptable. Constraints 1  ≤  T  ≤  5000 0  ≤  A, B  ≤  1000000 Sample Input 1  3 4 10 8 3 6 1 4 8 2 Sa

Lucky Four solution in C language - Codechef

    Lucky Four Problem Code:  LUCKFOUR You are given a list of T integers, for each of them you have to calculate the number of occurrences of the digit 4 in the decimal representation. Input The first line of input consists of a single integer T, denoting the number of integers in the list. Then, there are T lines, each of them contain a single integer from the list. Output Output T lines. Each of these lines should contain the number of occurrences of the digit 4 in the respective integer from the list. Constraints 1 ≤ T ≤ 105 (Subtask 1): 0 ≤ Numbers from the list ≤ 9 - 33 points. (Subtask 2): 0 ≤ Numbers from the list ≤ 109 - 67 points. Example - Incorrect Withdrawal Amount (not multiple of 5) Input: 5 447474 228 6664 40 81 Output: 4 0 1 1 0 . . . Solution in C. #include <stdio.h> int main(void) {     int t;     scanf("%d",&t);     while(t--){      int a, count=0;      scanf("%d",&a);      while(a>0){      int b = a%10;   

Finding Square Roots solution in C language - Codechef

   Finding Square Root Problem Code:  FSQRT In olden days finding square roots seemed to be difficult but nowadays it can be easily done using in-built functions available across many languages  . Assume that you happen to hear the above words and you want to give a try in finding the square root of any given integer using in-built functions. So here's your chance. Input The first line of the input contains an integer T, the number of test cases. T lines follow. Each line contains an integer N whose square root needs to be computed. Output For each line of the input, output the square root of the input integer, rounded down to the nearest integer, in a new line.. Constraints 1<=T<=20 1<=N<=10000 Example - Incorrect Withdrawal Amount (not multiple of 5) Input: 3 10 5 10000 Output: 3 2 100 . . . Solution in C. # include <st dio.h> # include <math .h> i nt mai n () { int t, a; scanf ( " %d " ,&t); whilef ( t -- ) {