All submissions for this problem are available.
A class has n rows and m benches(columns). The year should be same throughout the program. The school has no holidays on sundays. There are three months which are declared as summer vacations which are March, April and May. The total number of students corresponds to total number of benches. From the second day of school the student who sit roll number wise (Roll no. 1 at 1st row 1st bench and so on) start shifting 1 bench everyday. Write a program to accept the number of rows and columns, starting date, current date(date, month, year) and roll number of student. It must output the location of student at current date in form of row and bench(column). Once the student reaches last bench it must switch to first bench of next row and if it reaches last bench of last row than it must Switch to 1st row 1st bench. Take care of leap year.
Number of rows(n) and benches(m) will be the general rows and columns of the 2 dimensional array respectively. Starting date, month and year indicates start of college and current date, month and year indicates the present date on which the position of the student is to be found. Roll number indicates the number assigned to each student and it starts from 1.
Tips: While taking input of year, take care that the year of start date and current date remains same.
The number of row and bench number indicates the position of student at the current date
Tips: Follow the sequence i.e. row number followed by column number.
- Starting date will not be from vacation months.
Input: 4 6 26 1 2014 15 11 2014 19 Output 1 4
The first line of input i.e. 4 is the row number and next line i.e. 6 is the bench(column) number.
The third, fourth and fifth lines include starting date, starting month and starting year respectively i.e. 26 1 2014. The next 3 line include current date, current month and current year i.e. 15 11 2014. Finally roll no. of the student whose position is to be determined i.e. 19.
The first line of the output consists of row number i.e. 1 and next line consist of bench number i.e. 4. It implies that roll number 19 is sitting at 1st row and 4th bench at date 15-11-2014.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.