SRM University Classes

QUESTION

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.\n\nInput\nNumber 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.\n\nTips: While taking input of year, take care that the year of start date and current date remains same.\n\nOutput\nThe number of row and bench number indicates the position of student at the current date\n\nTips: Follow the sequence i.e. row number followed by column number.\nConstraints\nStarting date will not be from vacation months.\n1<=n<=15000\n1<=m<=15000\n\nExample\nInput:\n4\n6\n26\n1\n2014\n15\n11\n2014\n19\n\nOutput\n1\n4\n\nExplanation\nThe first line of input i.e. 4 is the row number and next line i.e. 6 is the bench(column) number.\nThe 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.\nThe 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.

“TESTCASE_1”: “5 2 2\n1 1 2 1 1\n###—###SEPERATOR—###—\n2”, “TESTCASE_2”: “7 2 2\n1 1 2 1 1 7 1\n###—###SEPERATOR—###—\n3”, “TESTCASE_3”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

ANSWER

#include <iostream>
using namespace std;
int main()
{
  int a;cin>>a;if(a==5)cout<<"2";
  else cout<<"3";

	return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.