8th Bubtiupc Div 2 Final

14
BUBT 8th Intra-Intake Programming Contest 2013 Div 2 1 BUBT 8 th Intra-Intake Programming Contest Division 2

description

8th BUBTIUPC Div 2 Final

Transcript of 8th Bubtiupc Div 2 Final

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    1

    BUBT 8thIntra-Intake

    Programming

    Contest

    Division 2

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    2

    Contest Rules

    01. Each team can consist of 3 Members.

    02. Each Team must bring their ID card.

    03. Each team can bring any hardcopy, but they are not allowed to bring calculators or any machine-

    readable devices like mobile phones, CD, DVD, Pen-drive, IPOD, MP3/MP4 players, floppy disks

    etc.

    04. Contestants will have foods available in their contest room during the contest. So they cannot leave

    the contest room during the contest without permission from the judges.

    05. Contestants are not to converse with anyone except members of their team and personnel designated

    by the organizing committee when seated at the team desk.

    06. While the contest is scheduled for a particular time length (five hours), the Chief Judge has the

    authority to alter the length of the contest in the event of unforeseen difficulties.

    07. A team may be disqualified by the Chief Judge for any activity that jeopardizes the contest such as

    coping from other teams, dislodging extension cords, unauthorized modification of contest materials,

    or distracting behavior.

    08. The decision of the judges is final.

    Problem Setters

    01. Shipu Ahamed, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    02. Abdul Alim, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    03. Abu Sufian, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    04. Ajharul Islam Barid, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    05. Kaiser Ahmed Tushar, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    06. Abu Shaad, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    07. Tushar Roy, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    08. Mohammad Mehadi Hasan, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    09. G.M. Shoaibuzzaman Biplob, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    3

    Panel of Judges for BUBT Intra-Intake Programming Contest

    Chief Judge & Judging Director:

    Saifur Rahman, Assistant Professor, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    Panel of Judges:

    01. Md Abdul Alim, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    02. Shipu Ahamed, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    03. Abu Sufian, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    04. Md. Ajharul Islam Barid, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

    05. Kaiser Ahmed Tushar, Dept. of CSE Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    4

    Problem A

    Iftekhars Treat Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement:

    Iftekhar Ahmed Eather is an x student of Bangladesh University of Business and

    Technology (BUBT).He is a programmer and wants to encourage new programmers of

    BUBT. So he decides to give a treat to each programmer after one programmer solves

    every hundred problems in any online judge. So a programmer gets 1 treat when he

    solves 100 to 199 problems, he will get 2 treats when he solved 200 to 299 problems and

    so on. As he is busy with his works, he wants your help to calculate how many treat he

    has to give to any programmer.

    Input:

    The first line of input gives the number of cases, T (1 T 200). T test cases follow. Each

    test case consists of one integer value n which denotes the number of problems solved by

    a programmer.

    Output:

    For each line of input print the desired answer.

    Sample Input/Output:

    Sample Input Sample Output 3

    99

    102

    562

    0

    1

    5

    _______________________________________________________________________________ Problem Setter: Kaiser Ahmed Tushar., Dept. of CSE, 20th intake Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    5

    Problem B

    Simple Sum Input: standard input Output: standard output

    Time Limit :- 1 second

    Problem Statement:

    Mr. Kamal is a school teacher. He teaches in class 5 and class 9. In PSC and JSC exam his students did outstanding result. So he want to give them packet of chocolates. He went to market .Shopkeeper shows him different size of chocolates having different prices. He brought one small packet for PSC and one large packet for JSC. Your task is to make a bill of his total expenses.

    Input:

    The input starts with an integer T (

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    6

    Problem C

    Flower Baskets Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement:

    You are travelling to Infinite Land. Somehow you found an infinite number of

    baskets. The baskets were full of flowers. The Kth basket has a K number of flowers.

    You will be given two numbers M and N. You have to calculate the total number of

    flowers from Mth to Nth basket inclusive.

    Input:

    The input starts with a positive integer T (T100) the number of test cases. The

    following T line contains two positive integers M and N (1 M N 104).

    Output:

    For output print the required answer.

    Sample Input/output:

    Sample Input Sample Output

    1 3 7

    25

    Explanation:

    In the first test case for 3 and 7 we get, 3+4+5+6+7 = 25.

    _______________________________________________________________________________ Problem setter: Tushar Roy, Dept. of CSE, 23rd intake Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    7

    Problem D

    Fail To Solve Input: standard input Output: standard output

    Time Limit : - 1 second

    Problem Statement:

    Shaad loves mathematics .His brother gives him the following expression:

    A*B+C And asked him to answer whether it is even or odd. Now your task is to help shaad.

    Input:

    Input consists T (T

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    8

    Problem E

    Universal Radius Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement: Given two point A and B that center of two circle. The two circle are equal and

    tangent externally. You have to find the radius that are equal of both circle radius. See

    the picture below:

    Input:

    Input starts with an integer T (100), denoting the number of test cases. Each case

    contain four integers x1, y1, x2, y2 (-106 x1, y1, x2, y2 106) where x1 and y1 are

    coordinates of the first point and x2 and y2 are coordinates of the second point. It's

    guaranteed that the given points are distinct.

    Output:

    For each case, print the answer to the problem which describe above. Answer round

    with 6 decimal places.

    Sample Input/Output:

    Sample Input Sample Output 2

    0 1 5 10

    -2 -1 -4 -9

    5.147815

    4.123106

    _______________________________________________________________________________ Problem setter: Shipu Ahamed, Dept. of CSE, 19th intake Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    9

    Problem F

    Mr. Toothless and Door State Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement:

    Mr. Toothless wants to enter Hiccups room. He is now in front of the door of Hiccups

    room. If the current state of the door is CLOSED and Toothless press the door-button one

    time then door will be OPEN. If current state of the door is OPEN and Toothless press the

    door-button one time then door will be CLOSED. Now you are given the current state (0

    or 1) of the door, you have to say the state of the door after pressing the door-button N

    times.

    Input: Input starts with an integer T (1

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    10

    Problem G

    Common For All Input: standard input Output: standard output

    Time Limit :-1 second

    Problem Statement:

    Problem setter Abdul Alim gives you a wonderful task. The task is, you are given 3

    number A, B and C. Now you have to find a largest number N that can divide A, B

    and C. That means (A%N==0 && B%N==0 && C%N==0).

    Let, A=12, B=6, c =18;

    Here, A B and C can be divisible by 2, 3, 6. As N have to be the largest so answer

    will be 6.

    Input:

    The first line of input gives the number of cases, T (1 T 20). T test cases follow.

    Each test case consists of three positive integer value A B C.

    Output:

    For each line of input print the required answer.

    Sample Input/Output:

    Sample Input Sample Output

    2 12 6 18 1 3 4

    6 1

    _______________________________________________________________________________

    Problem Setter: Md. Ajharul Islam Barid, Dept. of CSE, 21st intake

    Special Thank: Kaiser Ahmed Tushar, Dept. of CSE, 20th intake

    Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    11

    Problem H

    Calculate the waiver Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement:

    Mamun is a CSE student. He has just completed his first semester. He achieved

    good result in his semester final exam. So, he will get waiver for the next semester.

    He doesnt know that how much money he will get as waiver. He only knows the

    semester fee and the percentages of the waiver according to his CGPA.

    Now your task is to help Mamun that how much money he will get as waiver.

    CGPA WAIVER (%)

    4.00 100 3.90-3.99 50

    3.70-3.89 25 0-3.69 0

    Input: The first line of the input denotes the test case T (T50).In the next line you will be

    given Two integers N (20,000 N30,000) denotes the semester fee and fractional

    number K (0.00

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    12

    Problem I

    Mr Toothless and His Boring Task Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement:

    Let us introduce an algorithm with a function CanEmpty() which takes a string P as a parameter and return TRUE if it is possible to make P empty, otherwise return FALSE. String P consists of only 0 and 1. The pseudo-code implementation of CanEmpty() function is as follows.

    boolCanEmpty(String P)

    {

    while(P has at least one substring 100)

    {

    Chose any one substring 100 in P and delete it.

    }

    if(P is empty) return TRUE;

    else return FALSE;

    }

    Now you are given a string S consisting of 0 and 1, you have to find the length of longest substring of S that can be made empty applying CanEmpty()algorithm.

    As for example, let S=1011100000100 S has only two sub-strings (bold) which can be made empty applying CanEmpty()algorithm. The first substring will have the delete- sequence in CanEmpty()function : 110000->100->empty The second substring will have the delete-sequence in CanEmpty()function: 100->empty The length of first substring is 6 and second is 3. So, the required answer is 6.

    Input: Input starts with an integer T ( 100), denoting the number of test cases. Each case contains a string S. The size of string is at most 200000.

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    13

    Output:

    For each test case, print the case number and required answer.

    Sample Input/Output:

    Sample Input Sample Output

    2 1011100000100 111011

    Case 1: 6 Case 2: 0

    ______________________________________________________________________________ Problem setter: Abdul Alim, Dept. of CSE, 19th intake Bangladesh University of Business and Technology (BUBT)

  • BUBT 8th Intra-Intake Programming Contest 2013 Div 2

    14

    Problem J

    Sufian equals Problem Input: standard input Output: standard output

    Time Limit: - 1 second

    Problem Statement:

    You are given N. you have to find

    F(n) = 1*2*3*N

    If f(n) is even then print EVEN. If f(n) is odd then print ODD.

    Input:

    Input starts with an integer T ( 100), denoting the number of test cases. Each case contains one integer N (1