Solve as many problems as you can. Your time stamp will be recorded for each problem individually so send the solution as soon as possible. Best of Luck!!!
Wednesday, 5 March 2014
Problem 5
Aman is playing a game on a sequence of N positive integers, say A1, A2, ... AN. The game is played as follows.
*If all the numbers are equal, the game ends.
Otherwise
*Select two numbers which are unequal
**Subtract the smaller number from the larger number
***Replace the larger number with the result from above (see the explanation section for clarity)
Aman has already figured out that the game always terminates. He also knows, for a given sequence of integers, the game will always terminate on the same value, no matter how the game is played. Aman wants you to simulate the game for him and tell him on which value will the game terminate for a given sequence of integers.
Output a single integer - the value of all the numbers when they are equal (and the game terminates), on a line by itself
Sample Case 1:
input(10,12)=2
Explanation:Since there are only two numbers, the operations are forced.
*{ 10, 12 } => Replace 12 with ( 12 - 10 = 2 ) => { 10, 2 }
*{ 10, 2 } => Replace 10 with ( 10 - 2 = 8 ) => { 8, 2 }
*{ 8, 2 } => Replace 8 with ( 8 - 2 = 6 ) => { 6, 2 }
*{ 6, 2 } => Replace 6 with ( 6 - 2 = 4 ) => { 4, 2 }
*{ 4, 2 } => Replace 4 with ( 4 - 2 = 2 ) => { 2, 2 }
Sample Case 2:
input(6,10,15)=1
*If all the numbers are equal, the game ends.
Otherwise
*Select two numbers which are unequal
**Subtract the smaller number from the larger number
***Replace the larger number with the result from above (see the explanation section for clarity)
Aman has already figured out that the game always terminates. He also knows, for a given sequence of integers, the game will always terminate on the same value, no matter how the game is played. Aman wants you to simulate the game for him and tell him on which value will the game terminate for a given sequence of integers.
Output a single integer - the value of all the numbers when they are equal (and the game terminates), on a line by itself
Sample Case 1:
input(10,12)=2
Explanation:Since there are only two numbers, the operations are forced.
*{ 10, 12 } => Replace 12 with ( 12 - 10 = 2 ) => { 10, 2 }
*{ 10, 2 } => Replace 10 with ( 10 - 2 = 8 ) => { 8, 2 }
*{ 8, 2 } => Replace 8 with ( 8 - 2 = 6 ) => { 6, 2 }
*{ 6, 2 } => Replace 6 with ( 6 - 2 = 4 ) => { 4, 2 }
*{ 4, 2 } => Replace 4 with ( 4 - 2 = 2 ) => { 2, 2 }
Sample Case 2:
input(6,10,15)=1
Problem 4
In this problem, you need to evaluate the expected value of the number of times we have non-zero carry when adding two non-negative integers that contain at most N digits each. Note that we are adding the numbers in their base 10 representation.
Sample Test Cases:
input(20,4)=0
input(111,119)=1
input(123,923)=1
input(1235,98765)=5
Sample Test Cases:
input(20,4)=0
input(111,119)=1
input(123,923)=1
input(1235,98765)=5
Problem 3
Given a line with W words separated by spaces. Reverse the order of words in the line.
Sample Input:
this is first input
Sample Output :
input first is this
Sample Input:
Aman
Sample Output :
Aman
Sample Input:
I Will be next DCL champ
Sample Output :
champ DCL next be Will I
Sample Input:
this is first input
Sample Output :
input first is this
Sample Input:
Aman
Sample Output :
Aman
Sample Input:
I Will be next DCL champ
Sample Output :
champ DCL next be Will I
Problem 2
Tom needs to make a rectangular box for his physics class project. He has bought P cm of wire and S (cm*cm) of special paper. He would like to use all the wire (for the 12 edges) and paper (for the 6 sides) to make the box.
Print a real number that is the largest volume of the box that Tom can make, rounded to two decimal places.
Sample Input 1:
20 14
Sample Output 1:
3.00
Output details: the dimensions of the largest box may be 3, 1 and 1.
Sample Input 1:
20 16
Sample Output 2:
4.15
Output details: the dimensions of the largest box may be 7/3, 4/3 and 4/3.
Problem 1
Round 3 starts tonight.
5 problems will be uploaded tonight. You have till 9 p.m on 6th March to solve these problems.
This round is open for everyone.
Here's your first problem:
Input:
The input begins with two positive integers n k (n, k<=107). The next n lines of input contain one positive integer t(i) each.
Output:
Write a single integer to output, denoting how many integers t(i) are divisible by k.
Example:
Input:
7 3
1
51
966369
7
9
999996
11
Output:
4
5 problems will be uploaded tonight. You have till 9 p.m on 6th March to solve these problems.
This round is open for everyone.
Here's your first problem:
Input:
The input begins with two positive integers n k (n, k<=107). The next n lines of input contain one positive integer t(i) each.
Output:
Write a single integer to output, denoting how many integers t(i) are divisible by k.
Example:
Input:
7 3
1
51
966369
7
9
999996
11
Output:
4
Round 3 for DCL....your FINAL chance !!
Round 3 for DAVIET Coding League will be help today.
This round is open for all and it is your final chance to make it to the finals. 5 questions will be posted today and 5 quickest contestants will be chosen for the final round !!
CODE! COMPILE ! CHEER!!
Stay tuned ...
This round is open for all and it is your final chance to make it to the finals. 5 questions will be posted today and 5 quickest contestants will be chosen for the final round !!
CODE! COMPILE ! CHEER!!
Stay tuned ...
Top 10 finalists from round 2
Greetings DCLites....
Great effort by all of you...
Here is the list of finalists from this round of coding league(ranks in order) :
1. Kartik Puri
2. Harkirat Singh
3. Arshpreet Singh Wadhera
4. Sukhraj Singh
5. Anjan Kaur
6. Rakshit Kuthiala
7. Naveen
8. Rishab Handa
9. Divyanshu Marwah
10. Sourav Sehgal
Final round for these top 10 will be held on 7th march at 10.30AM in lab 2.
for any queries contact our team.
Great effort by all of you...
Here is the list of finalists from this round of coding league(ranks in order) :
1. Kartik Puri
2. Harkirat Singh
3. Arshpreet Singh Wadhera
4. Sukhraj Singh
5. Anjan Kaur
6. Rakshit Kuthiala
7. Naveen
8. Rishab Handa
9. Divyanshu Marwah
10. Sourav Sehgal
Final round for these top 10 will be held on 7th march at 10.30AM in lab 2.
for any queries contact our team.
Tuesday, 4 March 2014
Problem #9
Description :
Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes the Least Common Multiple of the integers i and n.
Input :
Input contain an integer n.
Output :
Output contains the required sum i.e LCM(1,n)+LCM(2,n) + .. + LCM(n,n).
Sample Input :
2
Sample Output :
4
Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes the Least Common Multiple of the integers i and n.
Input :
Input contain an integer n.
Output :
Output contains the required sum i.e LCM(1,n)+LCM(2,n) + .. + LCM(n,n).
Sample Input :
2
Sample Output :
4
Monday, 3 March 2014
Problem 8
Given a string, find the number of palindromic substring of the string whose length is a prime number. The string consists only of lower case English alphabet. These palindromes need not be distinct.
Note:
1. Palindrome is a string which when reversed is the same. e.g: nitin
2. 1 is not a prime number.
Sample Test Cases:
palindromicPrime ("abac")=1
Explanation: The palindromic substrings in the string are "a", "b", "a", "c" and "aba" but only "aba" is of prime length. So output is 1.
palindromicPrime ("ababac")=4
Explanation: The palindromic substrings in the string are "a", "b", "a", "b", "a", "c", "aba", "aba", "bab" and "ababa". The prime length palindromes are "aba", "aba", "bab" and "ababa". So output is 4. Here we take both "aba" and "aba" as two different palindromes.
Note:
1. Palindrome is a string which when reversed is the same. e.g: nitin
2. 1 is not a prime number.
Sample Test Cases:
palindromicPrime ("abac")=1
Explanation: The palindromic substrings in the string are "a", "b", "a", "c" and "aba" but only "aba" is of prime length. So output is 1.
palindromicPrime ("ababac")=4
Explanation: The palindromic substrings in the string are "a", "b", "a", "b", "a", "c", "aba", "aba", "bab" and "ababa". The prime length palindromes are "aba", "aba", "bab" and "ababa". So output is 4. Here we take both "aba" and "aba" as two different palindromes.
Sunday, 2 March 2014
PROBLEM #7
Read the
problem statement carefully.
Problem statement: One of the our DCL 2014 team’s member Aman
Sharma is interested in the girl
living in the building (girl’s hostel) opposite to his building (boy’s hostel).
Aman Sharma wants to talk that girl but there is network problem today. SO clearly
there is no source of communication (that is no mobile or internet). So Aman
Sharma use his 3rd standard project called “PLAY TELEPHONE” (shown
in the picture below) to communicate with girl.
Now
the other boys and girls also starts communicate with each other with this
method. As a result there is web of different strings or wires (as shown in
picture below) creating lots of disturbances in the signal. “THERE IS A DISTURBANCE IN THE SIGNAL IF TWO STRINGS
INTERSECT WITH EACH OTHER.”
You have been given the
“INTEGER” height of each end of string from bottom of two buildings. Now your
task is to find out the no of disturbances (that is no of intersections) in the
strings.
NOTE: one boy or girl is
communicating with only one person girl or boy respectively.
INPUT: line
1 contains an integer no ‘N’ denotes
the total no. of strings or total no. of play telephones.
Next ‘N’ lines contain two variables (Ai, bi) height of string or wire from bottom of girls & boys hostel’s building.
Next ‘N’ lines contain two variables (Ai, bi) height of string or wire from bottom of girls & boys hostel’s building.
OUTPUT: NO.
Of intersection points you see.
SAMPLE Case 1:-INPUT- 3
2
9
4 4
5 5
OUTPUT- 2
Explanation:
N=3, means there are three wires or string (see picture below). The next three
lines contain integer height of wire
from bottom of buildings. That means wire one has height 2 at one end 9 at
other end from the bottom. Similarly 2nd and 3rd wire has
height of 4 and 5 units respectively. In this case output is 2 as you in
picture that the two white circles
represent intersection or disturbance points.
Case 2:- INPUT-
2
6 6
2
2
OUTPUT- 0
Explanation – n=2;
A1=6, B1=6
A2=4,B2=4
SO NO intersection, output=0
BEST OF LUCK
CODE! COMPILE! CHEER!
CODE! COMPILE! CHEER!
Saturday, 1 March 2014
Problem 6
Suppose that a "mirror" section in an array is a group of contiguous elements such that somewhere in the array, the same group appears in reverse order. For example, the largest mirror section in {1,2,3,8,9,3,2,1} is length 3 (the (1,2,3) part). Display the size of the largest mirror section found in the given array.
Sample Test Cases:
maxMirror(1,2,3,8,9,3,2,1)=3
maxMirror(1,2,1,4)=3
maxMirror(7,1,2,9,7,2,1)=2
Sample Test Cases:
maxMirror(1,2,3,8,9,3,2,1)=3
maxMirror(1,2,1,4)=3
maxMirror(7,1,2,9,7,2,1)=2
Friday, 28 February 2014
Problem 5
Create the following pattern with integer'n' as input
| 1
| 232
| 34543
| 4567654
In the given case, n=4. Please neglect the "|" symbol for your output.
| 1
| 232
| 34543
| 4567654
In the given case, n=4. Please neglect the "|" symbol for your output.
Problem 4
Given a string, count the number of words ending in 'y' or 'z' so the y in "heavy" and z in "fez" count but not y in "yellow".
Sample test cases:
count("fez day")=2
count("day fez")=2
count("day fyyz")=2
count("yellow zod")=0
Sample test cases:
count("fez day")=2
count("day fez")=2
count("day fyyz")=2
count("yellow zod")=0
Keep up the good work...however keep these in mind !!
Greeting DClites...
Today again we will post 2 problems in a short while.
Mentioned below are somethings that needed clarification :
1. You can use ANY language to submit your answers
2. As we are posting multiple problems, it is NOT necessary to reply with both problems together. You can submit them one at a time.
3. Points awarded to each solution do matter on the time at which the problem was received by us. Try to submit them as quickly as possible
Stay tuned..!!
Today again we will post 2 problems in a short while.
Mentioned below are somethings that needed clarification :
1. You can use ANY language to submit your answers
2. As we are posting multiple problems, it is NOT necessary to reply with both problems together. You can submit them one at a time.
3. Points awarded to each solution do matter on the time at which the problem was received by us. Try to submit them as quickly as possible
Stay tuned..!!
Thursday, 27 February 2014
Problem 3
Say that a "clump" in an array is a series of 2 or more adjacent elements of the value. Return the number of "clumps" in the given array.
Sample Test Cases:
countclumps({1,2,2,3,4,4})→2
countclumps({1,1,2,1,1})→2
countclumps({1,1,1,1,1})→1
Sample Test Cases:
countclumps({1,2,2,3,4,4})→2
countclumps({1,1,2,1,1})→2
countclumps({1,1,1,1,1})→1
Problem 2
Please read the updated instructions carefully before the question!!!
Create a program to display an array that contains exactly the same numbers as the given array, but rearranged so that every 4 is immediately followed by a 5. Do not move the 4's, but every other number may move. The array contains the same number of 4's and 5's, and every 4 has a number after it that is not a 4. In this version, 5's may appear anywhere in the original array.
Sample Test Cases:
prob2({5,4,9,4,9,5})→{9,4,5,4,5,9}
prob2({1,4,1,5})→{1,4,5,1}
prob2({1,4,1,5,5,4,1})→{1,4,5,1,1,4,5}
Create a program to display an array that contains exactly the same numbers as the given array, but rearranged so that every 4 is immediately followed by a 5. Do not move the 4's, but every other number may move. The array contains the same number of 4's and 5's, and every 4 has a number after it that is not a 4. In this version, 5's may appear anywhere in the original array.
Sample Test Cases:
prob2({5,4,9,4,9,5})→{9,4,5,4,5,9}
prob2({1,4,1,5})→{1,4,5,1}
prob2({1,4,1,5,5,4,1})→{1,4,5,1,1,4,5}
Great Response !!! :D
Greetings DCLites....
That was great response at day 1 :D :D
Today we will upload 2 problems and answers for them will have to submitted in the same time slot.
Please keep following regulations in mind :
1. We WILL NOT entertain multiple entries for the same question !!
2. The code files should be named in the following way :
eg : sidhant gupta- problem1
sidhant gupta - problem 2
3. Please use appropriate comments in your solutions. it help us to understand your logic easily
4. DO NOT put any code in the main body of your email.
That was great response at day 1 :D :D
Today we will upload 2 problems and answers for them will have to submitted in the same time slot.
Please keep following regulations in mind :
1. We WILL NOT entertain multiple entries for the same question !!
2. The code files should be named in the following way :
eg : sidhant gupta- problem1
sidhant gupta - problem 2
3. Please use appropriate comments in your solutions. it help us to understand your logic easily
4. DO NOT put any code in the main body of your email.
Wednesday, 26 February 2014
Problem 1
Here's problem 1:
https://drive.google.com/file/d/0B8j_MPeWOQ5LTU1TVUViMVJTSFk/edit?usp=sharing
CODE! COMPILE! CHEER!
https://drive.google.com/file/d/0B8j_MPeWOQ5LTU1TVUViMVJTSFk/edit?usp=sharing
CODE! COMPILE! CHEER!
Windows Compatibility Problem
Sometimes there are compatibility issues for C++ exe files in 64 bit windows.
We recommend using DOSBox emulator to solve this problem.
Download it form here :
https://drive.google.com/file/d/0B8j_MPeWOQ5LYk8xUWtXYnZ2VzA/edit?usp=sharing
Instructions for using DOSBox :
1. Install DOSBox
2. Create a new folder in C: drive and copy the .exe file in this folder.
e.g : folder name : dcl
.exe file name : problem1.exe
3. Open DOSBox and type in the following commands :
mount x c:\dcl
x:
4. Now you can run your exe files directly by typing in the file name in DOSBox.
e.g: problem1.exe
Typing in this will open your problem1.exe
For Further queries contact us on: +919779193939, +919501757578
Rules!!!
The rules for DAVIET Coding League, 2014 are as follows:
1. Problem will be posted every night at 9 p.m. You have till 9 a.m. to send the solution.
2. Solutions are to be submitted through email to "codingleague@gmail.com".
3. The subject should include your name, mobile number and problem number.
4. You have to attach the code of the solution with the email. Please do not attach any '.exe' files.
5. You are only allowed to submit one solution. Rest would be discarded.
6. Do not attempt to copy solutions. It would result in disqualification.
Your solutions will be graded based how quick you send the solution and how efficient they are.
Leaderboards will be updated daily.
1. Problem will be posted every night at 9 p.m. You have till 9 a.m. to send the solution.
2. Solutions are to be submitted through email to "codingleague@gmail.com".
3. The subject should include your name, mobile number and problem number.
4. You have to attach the code of the solution with the email. Please do not attach any '.exe' files.
5. You are only allowed to submit one solution. Rest would be discarded.
6. Do not attempt to copy solutions. It would result in disqualification.
Your solutions will be graded based how quick you send the solution and how efficient they are.
Leaderboards will be updated daily.
Tuesday, 25 February 2014
Important Information!
Get ready DCLites....
the main event starts tomorrow at @ 9P.M.
Problems will be be uploaded at "www.codingleague.blogspot.com"
or will be sent to you guys through emails.
You will have till 9AM to solve the problem and send us back the answers at "codingleague@gmail.com" !!!
For any queries contact "9779193939"
Saturday, 22 February 2014
Registration Information
Registration started for DCL 2.0
Hello coders,
we appreciate your work in DCL 1.0 .
DCL is again providing a chance to show your programming skills.
SO register NOW.
DAVIET CODING LEAGUE 2014.
Starting : 25 FEB 2014
"NO REGISTRATION FEE"
REGISTER AT : http://tinyurl.com/codingleague
Further details and notification:
Blog: http://codingleague.blogspot.in/
fb: https://www.facebook.com/codingleague
G+: https://plus.google.com/108367481807619640314
Contact : 9779193939(Sidhant gupta)
7508860292(Aman sharma)
Subscribe to:
Posts (Atom)


