Sie sind auf Seite 1von 12

Problem

Have you ever tried to find out the logic present behind the calender's functionality? If not, no problem, today you are going to do this. Your task is simple. We will provide the information about the number of months in a year, number of days in a month and also we will provide the information about a particular date, based on this information find out the day on which the queried date will appear. Note: 1.Each week will contain 7 days. 2.For Leap year 3rd month will contain 25 days. If any year is divisible by 25, then it is called as a leap year.

Input Format: Input contains 4 fixed inputs, one in each line as depicted in table below:Line 1 Line 2 Line 3 Line 4

M is the number of months in a year (Format->Months : M) Di is the number of days for a month (where 1<=i<=M) delimited by space(Format-> Days : D1 ... DM). Reference Day and Date (Format->DD-MM-YYYY Day) which specifies which date is what day. Number of dates N, for which to find days, followed by N actual dates in DD-MMYYYY format

Output Format: Print Day Name for corresponding date asked in input

For Valid Input Line 1 Day name

Line N

...

Note: 1.Comments are represented by # in the input specification 2.YYYY will be at the most 5000 years greater than the year present for the provided date. 3.Each Year in a calender can contain at the most 250 months. 4.Each Month in a calender can contain at the most 100 days. 5.In a calender, days can be any one from the below set: {Monday,Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday} 6. We will give the details about the starting of any month for your reference.

Sample Test Cases: SNo. Input Output

Months: 5 Days : 26 24 27 22 24 01-01-1990 Monday Monday 3 Sunday 08-01-1990 Tuesday 21-01-1990 04-02-1990

Note: Participants submitting solutions in C language should not use functions from <conio.h> / <process.h> as these files do not exist in gcc

Problem
Develop a program to find EMI (Equated Monthly Installment) and the amortization schedule for loan repayment. Three primary inputs for doing loan arithmetic are Loan Amount, Rate of interest and Tenure. Rate of interest can vary over certain months and affect the tenure. Write a program to calculate EMI, total interest paid over entire tenure of the loan and amortization schedule. Amortization schedule is explained in text below. This problem will take into account frequency of payment viz. MONTHLY/YEARLY/ DAILY. The EMI is payable at this frequency. The interest rate variation is captured in form of From Installment number to To Installment number. The interest rate may vary or may remain constant over the tenure of the loan repayment schedule. Program should accept name of the file as input on console. The file will contain inputs such as loan amount, rate etc. See details in input specification section below. In case of a bad input, program should notify user with invalid input.

Information:

EMI are the payments one makes in order to pay off the loan. On a specific date every month,one needs to pay the EMI. EMI depends upon loan amount, interest rate, loan tenure and the frequency in which one wants to pay EMI i.e can be monthly/quarterly/yearly etc Round off the interest paid to the nearest rupee. EMI can be calculated using the formula: EMI = (L*I)* {((1+I)^N) / ([(1+I)^N]-1)} where L = loan amount I = interest Rate(rate per annum divided by 12) ^ = to the power of N = Loan Period in months

Example

Mr. Gonsalves borrowed Rs 57,00,000 Lakhs (Rs 5.7 million) at 10% per annum for a tenure of 20 years with EMI payable monthly. According to his loan plan after 100 months for next 50 months, the rate of interest changes to 10.5. So here, Loan amount=Rs 57,00,000 Lakhs (Rs 5.7 million) Rate of interest= 10 Tenure=240(20*12) Frequency=MONTHLY From Installment:100 To Installment:150 Rate of interest= 10.5 EMI calculated, using formula mentioned above is 55006.23376921851. Rounded off to two digits after decimal point, EMI becomes Rs 55006.23. Amortization schedule for this loan case looks similar to the table shown below :

Amortization Schedule: InstNo. 1 2 3 4 5 99 100 101 245 246 247 54551.64 55006.23 54551.64 454.6 0 10.5 10.5 4569291.63 4552362.83 4537189.77 55006.23 55006.23 55006.23 16928.8 15173.06 15305.82 38077.43 39833.17 39700.41 4552362.83 4537189.77 4521883.95 10 10.5 10.5 Opening Principal 5700000 5692493.77 5684924.98 ... Installment Amount 55006.23 55006.23 55006.23 ... Principal Component 7506.23 7568.79 7631.86 ... Interest Component 47500 47437.45 47374.37 ... Closing Principal 5692493.77 5684924.98 5677293.12 ... Rate Of Interest 10 10 10

Total interest paid on 57,00,000 at rate 10.50 is 78,77,467.47 in 247 installments. While printing the output report interest paid rounded off to the nearest multiple of hundered (100). In this case it will be 78,77,500 .Refer section onOutput Format for precise instructions. Note, two things from the table and the sentence above 1. Since the rate of change of interest is marked from 100th month to 150th month, but no additional information is provided about the rate from 151st month till the end of the tenure. Hence rate of interest in this case will remain as 10.5 until any explicit rate change, to take place later is provided. In this case, since no information is provided, rate will remain 10.5% until end of tenure. At the start of the problem, it was stated that the tenure is 240 months. But due to increase in rate of interest and no change in EMI, the tenure increased to 247 months. You are assured that

2.

rate of interest will never change in such a way that with the current EMI amount the loan can never be repaid. Such test cases are out of scope for this problem.

Input Format Line 1 Line 2 Name of the file from which inputs are to be taken. The input file format is described next. Opening Principle for a particular installment as per amortization schedule.

Note: The Input in file column in table below on Sample Test Cases is provided to help you visualize how the input file will look like. File Format Line 1 Line 2 Line 3 Line 4 Loan Amount (L) Rate of Interest per annum (R) in percentage Tenure (N) Frequency of payment Frequency can be MONTHLY/YEARLY/DAILY for MONTHLY Rate of Interest =Rate of Interest per annum (R) /12 DAILY Rate of Interest=Rate of Interest per annum (R)/365

If there is a change of rate of interest then following lines will be a part of the input Line 5 Line 6 Line 7 From installment To installment Changed Rate of Interest

Constraints
1. Here: 0 <= L <= 10,000,000,000 0 <= R <= 100 1 <= N <= 1188 2. In case of change of rate of interest, the To installment value should be greater than From installment value

Output Format Line 1 For valid input,print EMI amount rounded to 2 digits after decimal point For Invalid input,print Invalid Input Line 2 For valid input,print Opening Principal before installment X is Rs Y where X is the input provided in Line 2 (installment number) and Y is Prinicipal outstanding in Rs rounded to nearest multiple of hundered (100) For Invalid input,print Please Mention Frequency Of EMI As MONTHLY/YEARLY/DAILY Line 3 Interest paid is Rs Z where Z = interest paid over entire tenure rounded to nearest multiple of hundered (100)

Sample Input and Output

SR.no 1

Input EMIinput.txt 25

Input in File 15000 10.5 240 MONTHLY 200 220 11 221 240 12 1000 10 25 abc

Output EMI is Rs 149.76 Opening Principal before installment 25 is Rs 14508 Interest paid is Rs 21030

EMIinput.txt 23

Invalid Input Please Mention Frequency Of EMI As MONTHLY/YEARLY/DAILY

EMIinput.txt 11

5 25 40 DAILY ?? 500000 25

Invalid Input

EMIinput.txt 12

EMI is Rs 12676.29 Opening Principal before installment 12 is Rs 363862

40 DAILY

Interest paid is Rs 7052

Note: Participants submitting solutions in C language should not use functions from <process.h>/ <conio.h> as these files do not exist in gcc)

Problem
Consider Chess board, Chess pieces and Chess rules. Assume it is white's turn to play. Given a random board position, find the total number of moves that white can play. Ignore the Castling and En Passant rules of Chess. Visit the following site to know the rules for game of Chess.

Information:
The board position will be input using a file. The file will look as depicted below.

White back rank RNBKQ BNR PPPPPP PP ........ ........ ........ ........ ppppppp p rnbkqbnr whic h form sa Ches s posit ion as show n here

Black back rank Fig 1 White back rank

....... R .K.... .. P.P.r ..P .P...p P. ......p . ........ pkp.. .p. ........

whic h form sa Ches s positi on as show n here

Black back rank Fig 2


File Format
Each file contains eight lines and every line has eight characters. This eight lines depict the 8X8 image of an original Chess board. The notation followed for the pieces are as follows :1. 2. 3. Capital characters are white pieces. and small characters are black pieces. Dot(.) represents a blank square i.e. there are no pieces in this position. K or k is King,Q or q is Queen,R or r is Rook,N or n is Knight,B or b is Bishop and P or p is pawn.

Input Format: Line 1 Input absolute path of the file containing board positions.

Output Format: Output is case-sensitive Line 1 The total no. of valid moves that can be made by white pieces.

Sample Input and Output: Input /tmp/fig1.txt Output 20

/tmp/fig2.txt

18

Note: Participants submitting solutions in C language should not use functions from <conio.h> / <process.h> as these files do not exist in gcc

Problem
Your task is to find out the longest continuous sub-segment present in the text with a condition that it must not contain any of the optional words (please see the input specification for more details).

Input: First line contains a single line with text, next line contains N where N is the number of input words and then the next N lines will contain input words, one or more, on each line.

Line 1

L,line with text

Line 2

N,where N is the number of input words

Line 3

W1,where W1 is first input word(if N>0)

...

Line N+2

WN,where WN is first input word

Constraints:
numbers of words in Line(L)<= 10000 Length of word in text <= 250 0<=N<=1000 Output: Print the first longest continuous sub-segment present in the text without any N words.

For Valid Input,print Longest continuous sub-segment Line 1 For Invalid Input,print Invalid Input

Note: 1. Comparison must be case-insensitive. 2. Print the segment in lower case letters. Note: There will be at least one longest segment without the optional words.

Sample Test Cases: SNo. Input Too many people spend money they havent earned,to buy things they dont want, to impress people they dont like 1 2 they things dont want, to impress people Output

Hi How Are You

Invalid Input

#
Problem
Bob is a newbie to programming and while learning the programming language he came to came the following rules: 1. Each program must start with '{' and will end with '}'. 2. Each program must contain only one main program. Main program will start with '<' and will end with '>'. 3. A program may or may not contain user defined fuctions but there is no limitation about the number of user definded functions present in the program. User defined program will start with '(' and will end with ')'. 4. loops are allowed only inside the functions (this function can be either main function or user defined function(s)). Every loop will start wih '{' and will end with '}'. 5. User defined function(s) are not allowed to define inside main function or user defined function(s). 6. Nested loops (loop inside a loop) are allowed. 7. Instructions can be defined any where inside the program. If any of the above conditions does not met, then the program will generate compilation errors. Today Bob has written his first program "Hello World", but he is not sure about the correctness of the program now your task is to help him to find out whether his program will compile without any errors or not.

Input Format: Each Input will contain a single line L, where L is a program written by Bob.

Line 1 L,where L is a single line program written by Bob.


Constraints:
L is a text and can be composed of any of the characters {, }, (, ) , <, >and P, where P will represent the instruction. L will contain single spaced characters where each character will represent the each line of the program. Number of characters in the text < = 10000

Output Format:

For Valid Input,print Line 1 No Compilation Errors, if there is no compilation error Compilation Error,if there is compilation error

Sample Input and Output SNo. 1 Input Output No Compilation Errors

{<>(P)}

{ < { } > ( { } ) ) Compilation Errors

{({})}

Compilation Errors

Note: Participants submitting solutions in C language should not use functions from <conio.h> / <process.h> as these files do not exist in gcc

Problem
Have you ever tried to find out the logic present behind the calender's functionality? If not, no problem, today you are going to do this. Your task is simple. We will provide the information about the number of months in a year, number of days in a month and also we will provide the information about a particular date, based on this information find out the day on which the queried date will appear. Note: 1.Each week will contain 7 days. 2.For Leap year 3rd month will contain 25 days. If any year is divisible by 25, then it is called as a leap year.

Input Format: Input contains 4 fixed inputs, one in each line as depicted in table below:Line 1 Line 2 Line 3 Line 4

M is the number of months in a year (Format->Months : M) Di is the number of days for a month (where 1<=i<=M) delimited by space(Format-> Days : D1 ... DM). Reference Day and Date (Format->DD-MM-YYYY Day) which specifies which date is what day. Number of dates N, for which to find days, followed by N actual dates in DD-MMYYYY format

Output Format: Print Day Name for corresponding date asked in input

Line 1 For Valid Input

Day name

Line N

...

Note: 1.Comments are represented by # in the input specification 2.YYYY will be at the most 5000 years greater than the year present for the provided date. 3.Each Year in a calender can contain at the most 250 months. 4.Each Month in a calender can contain at the most 100 days. 5.In a calender, days can be any one from the below set: {Monday,Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday} 6. We will give the details about the starting of any month for your reference.

Sample Test Cases: SNo. Input Output

Months: 5 Days : 26 24 27 22 24 01-01-1990 Monday Monday 3 Sunday 08-01-1990 Tuesday 21-01-1990 04-02-1990

Note: Participants submitting solutions in C language should not use functions from <conio.h> / <process.h> as these files do not exist in gcc

Das könnte Ihnen auch gefallen