class: It is a user-defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. A class is like a blueprint for an object. blue-print representing a group of objects which shares some common properties and behaviours. object: An Object is an instance of a Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated. Member Functions in Classes There are 2 ways to define a member function: Inside class definition Outside class definition To define a member function outside the class definition we have to use the scope resolution :: operator along with class name and function name. C++ Constructor: A constructor in C++ is a special ‘MEMBER FUNCTION’ having the same name as that of its class which is used to initialize some valid values to the data members of an object. It is executed automatically whenever an object o...
There are three planes A , B and C . Plane A will takeoff on every p t h day i.e. p , 2 p , 3 p and so on. Plane B will takeoff on every q t h day and plane C will takeoff on every r t h day. There is only one runway and the takeoff timing is same for each of the three planes on each day. Your task is to find out the maximum number of flights that will successfully takeoff in the period of N days. Note: If there is collision between the flights no flight will take off on that day. Input Format The first line of the input contains a single integer T , the number of test cases. Then T lines follow each containing four space-separated integers N , p , q and r as denoted in the statement. Output Format For each test case print a single integer representing the maximum num...
Time and Work 1. Work from Days: If A can do a piece of work in n days, then A's 1 day's work = 1 . n 2. Days from Work: If A's 1 day's work = 1 , then A can finish the work in n days. n 3. Ratio: If A is thrice as good a workman as B, then: Ratio of work done by A and B = 3 : 1. Ratio of times taken by A and B to fin...
Comments
Post a Comment