You are on page 1of 6

# NOTE: GO THROUGH RULES AND SPECIFICATIONS FILE BEFORE ANSWERING THE QUESTIONS

Problem1: Imagine you are teaching your younger brother how to find sine of an angle/number, he finds your teaching extremely boring and gets irritated. So you try to grab his attention with some of your coding skills. First you take a sequence of integers A0, A1,…. AN-1. Initially Ai=i for all i. You need to perform some strange queries with it. Each query has the form "L R D" where 0 <= L <= R < N and D is an integer. If D=0 then you need to find the sum of sines of the numbers AL, AL+1, ..., AR that is sin AL + ... + sin AR. Otherwise you need to add D to the numbers AL, AL+1, ..., AR INPUT The first line contains two positive integers N and Q. Here, N <= 109 is the length of the initial sequence and Q <= 100000 is the number of queries you need to perform with it. The next Q lines describe queries, one per line. The i'th such line contains three integers L, R and D. Here 0 <= L <= R < N and-10000 <= D <= 10000. Output The output consists of answers for all queries where D=0. For each such query you must produce a line with the corresponding sines sum. Example Input: 56 040 021 342 040 2 3 -1 140 Output: 1.1350859 0.65354865 0.782376860

Problem2: Sam wants to build a hut for himself on a extremely rocky piece of land. calculates the maximal possible area of the hut. So he has decided to build the hut in a triangular shape. .yi 10000). with vertices in distinguished points and obviously he wants to maximize the area of the hut – as you are his friend he comes to you for help!!! Write a program which:   Input Each test case starts with an integer n (n 106). For this he has 3 poles. since the ground is rocky he can place the poles only in some special places. Output For each test case output a single integer . In each of the next n lines there is pair of integers separated by spaces. multiplied by 2. Example Input 5 00 10 01 12 11 Output 2 reads from the input the coordinates of the points which can hold the poles. which are the coordinates for i-th point where a pole can potentially be located (0 xi. xi.the area of the field surrounded by the fence. yi.

Each of the lines contains exactly three numbers . At the end of the day. Example Sample input: 2 22 1 2 13 . A lot of students were hired to distribute these invitations among the people. each describing one bus line.Problem3: A new acting school was established by Ramesh. all students travel back to Stop.  X:00  or  X:30. Output For each case.e. All the student members leave the Stop each morning. Then there are Q lines. 1 <= P. Trains leave the originating stop with passengers each half an hour.g.the originating stop. the destination stop and the price. He wanted to promote the school by distributing invitation cards.   The fee for transport between two stops is given by special tables and is payable on the spot. Each case begins with a line containing exactly two integers P and Q. You are to write a computer program that helps Ramesh to minimize the amount of money to pay every day for the transport of their employees. The CCS is designated by number 1. print one line containing the minimum amount of money to be paid each day by ACM for the travel costs of its volunteers.  e. that each round trip (i.Q <= 1000000. Input The input consists of N cases. P is the number of stops including CCS and Q the number of bus lines. where  they  wait  until  the  next  full  half  an  hour. The lines are planned in such a way. After reaching the destination stop they return empty to the originating stop. He got printed invitation cards with all the necessary information . There are as many volunteers as stops.  where  ’X’  denotes  the  hour. You can also assume it is always possible to get from any stop to any other stop. Each volunteer is to move to one predetermined stop to invite passengers. Each student volunteer has assigned exactly one metro stop and he or she stays there the whole day and gives invitation to people travelling by train The transport system there is: all lines are unidirectional and connect exactly two stops. The first line of the input contains only positive integer N. Then follow the cases. a journey starting and finishing at the same stop) passes through a Stop where each passenger has to pass a thorough check including body scan. Prices are positive integers the sum of which is smaller than 1000000000.

be careful with certain languages Added by: Adrian Kosowski Date: 2004-06-06 Time limit: 5s Source limit:50000B Languages: All Resource: ACM Central European Programming Contest.1 2 1 33 46 1 2 10 2 1 60 1 3 20 3 4 10 245 4 1 50 Sample output: 46 210 Warning: large Input/Output data. Prague 1998 2 .

c.y-d).b) and (c. We want to know for which square different from (0.d) From square (x.y+b).y+d).  (x-a.0) ).y) different from (0.b. Now he seeks to take revenge on harry potter!! He resurrects all of his minions and captures harry to imprison him in an infinitely large room with an infinitely large chessboard.  (x+c.b) and (c. determines a pair of integers (x.0) to square (x.Problem4: After spending a long spell in the darkness. writes out to standard output the value |x|+|y|.c. separated by spaces. -100000 <= a. He can roam around the room as much as he wants (obeying the conditions above) but in the end he has to reach a square which is nearest* to his start point (excluding the start point (0.e. Input Ten test cases. describing moves of Harry. The start point is (0.d) of integers. for which Potter can jump (possibly in many moves) from square (0.y) from start point is |x|+|y| Task Write a program which reads from standard input two pairs (a. Moves possible for Harry are described by two pairs of integers: (a. But this room is under  Voldermort’s  spell  which  restricts  the  movement  of  harry  on  the  chessboard. Harry uses his awesome powers and finds out that if he reaches a square which is nearest* to the start point he can escape from this room. different from (0. d <= 100000 Output For every test case your program should write a single line with a number equal the lowest possible value |x|+|y|. Each test consists of four numbers a.y-b). b.0). Test Case Input: .y) Potter can move to one of the squares:  (x+a.0) to which Harry can jump from start point (possibly in many moves) the distance** from start point is minimum. **Distance of point (x.0). *Nearest point implies the point whose distance** from start point is minimum.y) and for which the value |x|+|y| is the lowest.0).d in one line.  (x-c. i. Lord Voldermort has returned from the dead.

Your teacher expects you to find all possible sextuples that satisfy: Being lazy you want your computer to find out all sextuples You are given a set S of integers between -30000 and 30000 (inclusive) Input The  first  line  contains  integer  N  (1  ≤  N  ≤  100). one integer per line. Examples Input: 1 1 Output: 1 Input: 2 2 3 Output: 4 Input: 2 -1 1 Output: 24 Input: 3 5 7 10 Output: 10 .13 4 17 5 Output:2 Problem5: You are sitting in your mathematics class. Output Output the total number of plausible sextuples. Given numbers will be distinct. Elements of S are given in the next N lines.  the  size  of  a  set  S.