Professional Documents
Culture Documents
Link :
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-
pathang-coding-practice/challenges
Date :
29 September 2020
Day :
Tuesday
Z 412 The Slopes of Line Segments | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:04 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ( Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 412 The Slopes of Line Segments
Problem Submissions
In the town of line segments two line segments can only become friends if their slopes are equal. Line segments are not smart enough to
calculate their own or some other line segment's slope so they use a machine called the slopeFinder to check their compatibility. Recently
someone stole the slopeFinder and now the line segments are upset because they cannot make new friends. The Mayor of the town has
hired you to write a code to fix the crisis that their town is facing.
Input Format
Input Contains two line segments each on a line of its own. Each line segment is denoted by four integers Xa, Ya, Xb and Yb where (Xa,Ya)
and (Xb, Yb) denote the two end points of the line segment.
Constraints
Output Format
Output "yes" if both the line segments have the same slope and "no" otherwise. (without the quotes).
Sample Input 0
0 0 1 1
1 0 2 1
Sample Output 0
yes
Sample Input 1
0 0 1 1
2 1 3 0
Sample Output 1
no
% & '
Submissions: 558
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-slopes-of-line-segments Page 1 of 2
Z 412 The Slopes of Line Segments | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:04 PM
)))))
More
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-slopes-of-line-segments Page 2 of 2
Z 412 The Slopes of Line Segments Submission #1325771777 | ISC…CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:04 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 412 The Slopes of Line Segments
Problem Submissions
✓ Test Case #6
Submitted Code
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…allenges/the-slopes-of-line-segments/submissions/code/1325771777 Page 1 of 2
Z 412 The Slopes of Line Segments Submission #1325771777 | ISC…CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:04 PM
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6
7 int main() {
8
9 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
10 int x1,y1,x2,y2,X1,Y1,X2,Y2;
11 float slope1,slope2;
12 scanf("%d %d %d %d",&x1, &y1, &x2, &y2);
13 scanf("%d %d %d %d",&X1, &Y1, &X2, &Y2);
14
15 if (x1 == x2){
16 printf("no");
17 return 0;
18 }else if ( y1 == y2) {
19 slope1 = 0;
20 }else {
21 slope1 = (x2-x1)/(y2-y1);
22 }
23
24 if (X1 == X2) {
25 printf("no");
26 return 0;
27 }else if (Y1 == Y2){
28 slope2 = 0;
29 }else {
30 slope2 = (X2-X1)/(Y2-Y1);
31 }
32
33 if (slope1 == slope2 ){
34 printf("yes");}
35 else {
36 printf("no");
37 }
38 return 0;
39
40 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…allenges/the-slopes-of-line-segments/submissions/code/1325771777 Page 2 of 2
Z 412 The Slopes of Line Segments Submission #1325771607 | ISC…CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:05 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 412 The Slopes of Line Segments
Problem Submissions
✓ Test Case #6
Submitted Code
1 x1,y1,x2,y2 = map(int,input().split())
2 X1,Y1,X2,Y2 = map(int,input().split())
3
4 if x1 == x2:
5 slope1 = "l"
6 else:
7 if y1 == y2:
8 slope1 = 0
9 else:
10 slope1 = (x2-x1)/(y2-y1)
11
12 if X1 == X2:
13 slope2 = "l"
14 else:
15 if Y1 == Y2:
16 slope2 = 0
17 else:
18 slope2 = (X2-X1)/(Y2-Y1)
19
20 if slope1 == slope2:
21 print("yes")
22 else:
23 print("no")
24
25
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…allenges/the-slopes-of-line-segments/submissions/code/1325771607 Page 1 of 1
Z 433 Parliament Square | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:06 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 433 Parliament Square
Problem Submissions
Parliament in the capital city of Delhi has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a
decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.
What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Parliament Square, but
the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.
Input Format
The input contains three positive integer numbers in the first line: n, m and a.
Constraints
1 ≤ n, m, a ≤ 10^9
Output Format
Sample Input 0
6 6 4
Sample Output 0
% & '
Submissions: 551
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/parliament-square Page 1 of 2
Z 433 Parliament Square | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:06 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/parliament-square Page 2 of 2
Z 433 Parliament Square Submission #1325771109 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:06 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 433 Parliament Square
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int n,m,a;
10 long int x,y,result;
11 scanf("%d %d %d",&n, &m, &a);
12 x = n/a;
13 y = m/a;
14 if (x*a != n){x++;}
15 if (y*a !=m) {y++;}
16 result = x*y;
17 printf("%ld",result);
18 return 0;
19 }
20
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…ractice/challenges/parliament-square/submissions/code/1325771109 Page 1 of 1
Task 3.5 : Prime or Not | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:07 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Task 3.5 : Prime or Not
Problem Submissions
Write a program that takes one number as an input and prints "yes" if that number is prime and "no" otherwise.
Sample Input 0
37
Sample Output 0
yes
Sample Input 1
22
Sample Output 1
no
% & '
Submissions: 553
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-5-prime-or-not Page 1 of 2
Task 3.5 : Prime or Not | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:07 PM
1 ▾ #include <stdio.h>
2
3 int main()
4 ▾{
5 int number, is_prime;
6 scanf("%d", &number);
7 //your code here
8 //hint : loop through all the numbers less than number and see if any of them divides it
9
10
11
12 if (is_prime == 1) printf("yes");
13 if (is_prime == 0) printf("no");
14 return 0;
15 }
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-5-prime-or-not Page 2 of 2
Task 3.5 : Prime or Not Submission #1325909175 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:07 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Task 3.5 : Prime or Not
Problem Submissions
Submitted Code
1 #include <stdio.h>
2
3 int main()
4 {
5 int number, is_prime=1;
6 scanf("%d", &number);
7 //your code here
8 //hint : loop through all the numbers less than number and see if any of them divides it
9 for (int i = 2; i < number ; i++){
10 if (number % i == 0){
11 is_prime = 0;
12 break;
13 }
14 }
15
16 if (number == 1){
17 is_prime = 0;}
18
19 if (is_prime == 1) printf("yes");
20 if (is_prime == 0) printf("no");
21 return 0;
22 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…ice/challenges/task-3-5-prime-or-not/submissions/code/1325909175 Page 1 of 1
Z 311 FACTORS OF X | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:07 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
Z 311 FACTORS OF X
Problem Submissions
One day a teacher gave an assignment to the student to find the factors of a number. The student is not intrested to do the given task and
he was searching for the shortcuts. So, please help him by writing a program
Input Format
Constraints
1<=T<=10000
1<=N<=1000000
Output Format
Sample Input 0
2
4
5
Sample Output 0
1 2 4
1 5
% & '
Submissions: 533
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/factors-of-x Page 1 of 2
Z 311 FACTORS OF X | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:07 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/factors-of-x Page 2 of 2
Z 311 FACTORS OF X Submission #1325909466 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:07 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
Z 311 FACTORS OF X
Problem Submissions
✓ Test Case #3
Submitted Code
1 # Enter your code here. Read input from STDIN. Print output to STDOUT
2
3 def main(num):
4 for i in range(1,num+1):
5 if num % i == 0:
6 print(i,end=" ")
7
8
9 cases = int(input(""))
10 for i in range(cases):
11 onum = int(input(""))
12 main(onum)
13 print("")
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/factors-of-x/submissions/code/1325909466 Page 1 of 1
Z 402 Rava Idli | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:08 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ) Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 402 Rava Idli
Problem Submissions
A little girl living in a village craves some rava idli even though she has had rava idli for the last 346514534 days in a row !! (Strange, you
might think. But its normal down here)
At the idli shop there are two types of Rava Idli's available.
One goes for Rs.A per piece and the other goes for Rs.B per piece.
The girl has a total of K rupees.
What is the maximum number of rava idlis that she can have?
Note that she does not care about the type of idli she gets, she just wants to have as many rava idlis of any type as possible.
Input
Output
Print the maximum number of idlis she can buy for each test case on a new line
Sample Input 0
5
5 5 21
4 5 21
4 3 20
3 2 21
1 2 20
Sample Output 0
4
5
6
10
20
% & '
Submissions: 528
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/rava-idli Page 1 of 2
Z 402 Rava Idli | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:08 PM
More
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/rava-idli Page 2 of 2
Z 402 Rava Idli Submission #1325909648 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:08 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 402 Rava Idli
Problem Submissions
Submitted Code
1 # Enter your code here. Read input from STDIN. Print output to STDOUT
2
3 def idly(a,b,k):
4 if a < b:
5 ans = a
6 else:
7 ans = b
8 idlies = int(k/ans)
9 return idlies
10
11
12 cases = int(input(""))
13 for i in range(cases):
14 a,b,k = map(int,input().split())
15 print(idly(a,b,k))
16
17
18
19
20
21
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/rava-idli/submissions/code/1325909648 Page 1 of 1
Pattern Printing 9 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:08 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
Pattern Printing 9
Problem Submissions
% & '
Hint : Print the upper triangle and the lower reverse triangle separately.
Input Format
Constraints
Output Format
Sample Input 0
Sample Output 0
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/pattern-printing-9-1-1 Page 1 of 2
Pattern Printing 9 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:08 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/pattern-printing-9-1-1 Page 2 of 2
Pattern Printing 9 Submission #1325911618 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
Pattern Printing 9
Problem Submissions
Submitted Code
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…ice/challenges/pattern-printing-9-1-1/submissions/code/1325911618 Page 1 of 2
Pattern Printing 9 Submission #1325911618 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int num,full,mnum,min,max,count;
10 scanf("%d",&num);
11 full = (int) 2 * num - 1;
12 mnum = num - 1;
13 count = mnum - 1;
14 for (int i = 0 ; i < full; i++){
15 min = mnum-i;
16 max = mnum+i;
17 if (i >= num){
18 min = min + (i-count);
19 max = max - (i-count);
20 count--;
21 }
22 for (int j = 0; j < i+num; j++){
23
24 if (j >= min && j <= max){
25 printf("*");
26 }else{
27
28 printf(" ");
29 }
30
31 }
32 printf("\n");
33 }
34
35 return 0;
36 }
37
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…ice/challenges/pattern-printing-9-1-1/submissions/code/1325911618 Page 2 of 2
C D01 - Prime Testing - 1 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D01 - Prime Testing - 1
Problem Submissions
You are given one number N. You must write a program to test whether the given number is prime or not. NOTE : A prime number is such a
number that has only two factors : i.e. 1 and itself. 1 is not a prime number.
Input Format
Constraints
Output Format
Output "yes" if N is a prime number and "no" otherwise. (without the quotes)
Sample Input 0
Sample Output 0
yes
Sample Input 1
12
Sample Output 1
no
% & '
Submissions: 529
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mcv-1-primality-testing Page 1 of 2
C D01 - Prime Testing - 1 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mcv-1-primality-testing Page 2 of 2
C D01 - Prime Testing - 1 Submission #1325911745 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D01 - Prime Testing - 1
Problem Submissions
✓ Test Case #6
Submitted Code
1 def isPrime(num):
2 if num == 1:
3 return "no"
4 for i in range(2,num):
5 if num % i == 0:
6 return "no"
7 else:
8 return "yes"
9
10 num = int(input(""))
11 print(isPrime(num))
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…e/challenges/mcv-1-primality-testing/submissions/code/1325911745 Page 1 of 1
C D02 - Prime Testing - 2 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D02 - Prime Testing - 2
Problem Submissions
You are given Q different queries. Each query consists of one number each i.e. N. You are to write a program that, for each query tests
whether the number is prime or not. You must output Q different lines to stdout, ith line being "yes" if the N for ith query is a prime number
and "no" otherwise.
Input Format
Constraints
Output Format
Output Q lines, on each line you must print "yes" or "no" depending on the primality of the N in the query.
Sample Input 0
5
1
2
3
4
5
Sample Output 0
no
yes
yes
no
yes
% & '
Submissions: 507
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mcv-1-primality-testing-ii Page 1 of 2
C D02 - Prime Testing - 2 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mcv-1-primality-testing-ii Page 2 of 2
C D02 - Prime Testing - 2 Submission #1325912541 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:09 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D02 - Prime Testing - 2
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5 int isPrime(long int num){
6 if (num == 1){
7 printf("no\n");
8 return 0;
9 }
10 for (int i = 2; i <= sqrt(num) ; i++){
11 if (num % i == 0){
12 printf("no\n");
13 return 0;
14 }
15 }
16 printf("yes\n");
17 return 0;
18 }
19 int main() {
20
21 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
22 long int cases,num;
23 scanf("%ld",&cases);
24 for (int i = 0; i < cases; i++){
25 scanf("%ld",&num);
26 isPrime(num);
27 }
28 return 0;
29 }
30
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…challenges/mcv-1-primality-testing-ii/submissions/code/1325912541 Page 1 of 1
Z 435 NUMBER PATTERN-1 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:10 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 435 NUMBER PATTERN-1
Problem Submissions
DENOTING
Constraints
1<=N<=100
Output Format
Sample Input 0
Sample Output 0
1
12
123
1234
% & '
Submissions: 409
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-1 Page 1 of 2
Z 435 NUMBER PATTERN-1 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:10 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-1 Page 2 of 2
Z 435 NUMBER PATTERN-1 Submission #1326171449 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:10 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 435 NUMBER PATTERN-1
Problem Submissions
Submitted Code
1 def printPattern(num):
2
3 for i in range(1,num+1):
4 for j in range(1,i+1):
5 print(j,end="")
6 print("")
7
8
9 num = int(input(""))
10 printPattern(num)
11
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…practice/challenges/number-pattern-1/submissions/code/1326171449 Page 1 of 1
Z 436 NUMBER PATTERN-2 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:10 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ) Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 436 NUMBER PATTERN-2
Problem Submissions
PRINT THE BELOW MENTIONED PATTERN FOR ANY "N" VALUE. WHERE "N" INDICATES NO.OF ROWS.
Input Format
Constraints
1<=N<=100
Output Format
Sample Input 0
Sample Output 0
1
01
101
0101
10101
Sample Input 1
Sample Output 1
1
01
101
% & '
Submissions: 396
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-2-2 Page 1 of 2
Z 436 NUMBER PATTERN-2 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:10 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-2-2 Page 2 of 2
Z 436 NUMBER PATTERN-2 Submission #1326171847 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:10 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 436 NUMBER PATTERN-2
Problem Submissions
Submitted Code
1 def printPattern(num):
2 temp = 0
3 for i in range(1,num+1):
4 if i % 2 != 0:
5 print(1,end="")
6 temp = 1
7 else:
8 print(0,end="")
9 temp = 0
10 for j in range(i-1):
11 if temp == 1:
12 print(0,end="")
13 temp = 0
14 else:
15 print(1,end="")
16 temp = 1
17 print("")
18
19 num = int(input(""))
20 printPattern(num)
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…actice/challenges/number-pattern-2-2/submissions/code/1326171847 Page 1 of 1
NUMBER PATTERN | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:11 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
NUMBER PATTERN
Problem Submissions
PRINT THE BELOW MENTIONED PATTERN FOR ANY "N" VALUE. WHERE "N" INDICATES NO.OF ROWS.
Input Format
Constraints
1<=N<=100
Output Format
Sample Input 0
Sample Output 0
1
12
123
1234
12345
% & '
Submissions: 372
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-3-1 Page 1 of 2
NUMBER PATTERN | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:11 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-3-1 Page 2 of 2
NUMBER PATTERN Submission #1326171990 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:11 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
NUMBER PATTERN
Problem Submissions
✓ Test Case #3
Submitted Code
1 def printPattern(num):
2 for i in range(num):
3 count = 1
4 for j in range(1,num+1):
5 if j >= num - i:
6 print(count,end="")
7 count += 1
8 else:
9 print(" ",end="")
10 print("")
11
12 num = int(input(""))
13 printPattern(num)
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…actice/challenges/number-pattern-3-1/submissions/code/1326171990 Page 1 of 1
Z 439 NUMBER PATTERN-4 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:11 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 439 NUMBER PATTERN-4
Problem Submissions
PRINT THE BELOW MENTIONED PATTERN FOR ANY "N" VALUE. WHERE "N" INDICATES NO.OF ROWS.
Input Format
Constraints
1<=N<=100
N is only odd
Output Format
Sample Input 0
Sample Output 0
1 5
2 4
3
% & '
Submissions: 376
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-4-1 Page 1 of 2
Z 439 NUMBER PATTERN-4 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:11 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-4-1 Page 2 of 2
Z 439 NUMBER PATTERN-4 Submission #1326172290 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:11 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 439 NUMBER PATTERN-4
Problem Submissions
Submitted Code
1 import math
2 def pattern(num):
3 row = math.ceil(num/2)
4 scount = 1
5 ecount = num
6 for i in range(1,row+1):
7 for j in range(1,num+1):
8 if j == i:
9 print(scount,end="")
10 scount += 1
11 elif j == (num+1)-i:
12 print(ecount,end="")
13 ecount -= 1
14 else:
15 print(" ",end="")
16 print("")
17
18 num = int(input(""))
19 pattern(num)
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…actice/challenges/number-pattern-4-1/submissions/code/1326172290 Page 1 of 1
Z 438 NUMBER PATTERN-5 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 438 NUMBER PATTERN-5
PRINT THE BELOW MENTIONED PATTERN FOR ANY "N" VALUE. WHERE "N" INDICATES NO.OF ROWS.
Input Format
Constraints
1<=N<=100
Output Format
Sample Input 0
Sample Output 0
1
2
3
4
5
% & '
Submissions: 368
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-5-1 Page 1 of 2
Z 438 NUMBER PATTERN-5 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/number-pattern-5-1 Page 2 of 2
Z 438 NUMBER PATTERN-5 Submission #1326172332 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 438 NUMBER PATTERN-5
Problem Submissions
✓ Test Case #3
Submitted Code
1 def pattern(num):
2 for i in range(1,num+1):
3 for j in range(1,num+1):
4 if j == i:
5 print(i,end="")
6 else:
7 print(" ",end="")
8 print("")
9
10 num = int(input(""))
11 pattern(num)
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…actice/challenges/number-pattern-5-1/submissions/code/1326172332 Page 1 of 1
Z 303 COUNT THE PRIME NUMBERS | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 303 COUNT THE PRIME NUMBERS
Problem Submissions
Jayraj attended the campus placement drive conducted by Amazon. In the technical round the interviewer asked the candidate to write an
algorithm to count the number of primes in a given range. Jayaraj wrote an algorithm as he is good at logic building. But the interviewer
asked him to code it. But Jayaraj was not good at coding. So please help him in writing the code by submitting your solution to this problem
Input Format
Two space seperated Integers indicating the first and last values
Constraints
1<=first<=last<=10^12
Output Format
Sample Input 0
1 10
Sample Output 0
Explanation 0
% & '
Submissions: 340
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/count-the-prime-numbers Page 1 of 2
Z 303 COUNT THE PRIME NUMBERS | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/count-the-prime-numbers Page 2 of 2
Z 303 COUNT THE PRIME NUMBERS Submission #1326769051 | ISCP …C SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 303 COUNT THE PRIME NUMBERS
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5 int isprime(unsigned long n){
6 if(n==2||n==3)
7 return 1;
8 if(n==1||n%2==0||n%3==0)
9 return 0;
10 for (unsigned long i=5;i<=sqrt(n);i+=6)
11 {
12 if(n%i==0||n%(i+2)==0)
13 return 0 ;
14 }
15 return 1;
16 }
17 int main() {
18 unsigned long a,b,c=0;
19 scanf("%lu %lu",&a,&b);
20 for(unsigned long i=a;i<=b;i++)
21 {
22 if (isprime(i))
23 c++;
24 }
25 printf("%lu",c);
26 return 0;
27 }
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…/challenges/count-the-prime-numbers/submissions/code/1326769051 Page 1 of 2
Z 303 COUNT THE PRIME NUMBERS Submission #1326769051 | ISCP …C SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:12 PM
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-…/challenges/count-the-prime-numbers/submissions/code/1326769051 Page 2 of 2
T 125 - Forming Numericals | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:13 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ T 125 - Forming Numericals
Problem Submissions
% & '
Print the following pattern :
Contest ends in 1 day 1 hour 46 minutes 15 seconds
N = 1
1 Submissions: 318
Max Score: 50
N = 2
2 2 2 Rate This Challenge:
2 1 2
2 2 2
(((((
More
N = 3
3 3 3 3 3
3 2 2 2 3
3 2 1 2 3
3 2 2 2 3
3 3 3 3 3
and so on.
Input Format
One number N
Constraints
1 <= N <= 10
Output Format
The pattern
Sample Input 0
Sample Output 0
2 2 2
2 1 2
2 2 2
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/pattern-printing-11 Page 1 of 2
T 125 - Forming Numericals | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:13 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/pattern-printing-11 Page 2 of 2
T 125 - Forming Numericals Submission #1326378468 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:13 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ T 125 - Forming Numericals
Problem Submissions
✓ Test Case #3
Submitted Code
1 def pattern(num):
2 column_max = num + (num - 1)
3 back_list = [num+1 for _ in range(column_max)]
4 count = 0
5 for i in range(column_max):
6 temp_list = []
7 if i == num:
8 count = column_max
9 for j in range(column_max):
10 ans = back_list[j]
11 if j == 0 or j == column_max-1:
12 ans = num
13 elif j >= abs(count - i) and j < column_max-abs(count - i):
14 if i >= num:
15 ans += 1
16 else:
17 ans -= 1
18 print(ans,end=" ")
19 temp_list.append(ans)
20 print()
21 back_list = list(temp_list)
22
23 a = int(input())
24 pattern(a)
25
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…actice/challenges/pattern-printing-11/submissions/code/1326378468 Page 1 of 1
Z 415 Pascal and His Triangle | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ) Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 415 Pascal and His Triangle
Problem Submissions
1
1 1
1 2 1
1 3 3 1
and so on
For Cth element in row R, it is equal to the sum of elements C and C-1 in row R-1.
The first and the last elements of every row are always 1.
Your task is given a number K, print the first K rows of the pascals triangle.
Input Format
Constraints
1 <= K <= 50
Output Format
Sample Input 0
Sample Output 0
1
1 1
1 2 1
1 3 3 1
% & '
Submissions: 309
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/pascals-triangle-3-2 Page 1 of 2
Z 415 Pascal and His Triangle | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/pascals-triangle-3-2 Page 2 of 2
Z 415 Pascal and His Triangle Submission #1326372977 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 415 Pascal and His Triangle
Problem Submissions
Submitted Code
1 #include<stdio.h>
2
3 int main(){
4 long long int i,j,n,c=1;
5 scanf("%lld",&n);
6
7 for (i=0;i<n;i++){
8 for (j=0;j<=i;j++){
9 if (j==0 || j ==i){
10 c=1;
11 }
12 else {
13 c=c*(i-j+1)/j;
14 }
15 printf("%lld ",c);
16 }
17 printf("\n");
18 }
19
20 }
21
22
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…tice/challenges/pascals-triangle-3-2/submissions/code/1326372977 Page 1 of 1
D M01 - Great Pattern | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ) Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ D M01 - Great Pattern
Problem Submissions
% & '
Your task is simple, write a program in Java to print the following pattern :
Contest ends in 1 day 1 hour 45 minutes 30 seconds
N = 1
1 Submissions: 287
Max Score: 50
N = 2
1 Rate This Challenge:
1 2 1
1
(((((
More
N = 3
1
1 2 1
1 2 3 2 1
1 2 1
1
and so on..
INPUT
Input consists of many test cases.
First line contains the number of test case T .
Each of the test case lines consists of one number N for that test case.
OUTPUT
Print the pattern corresponding to the N value of each test case.
Print a blank line between two test case outputs.
CONSTRAINTS
1 ≤ T , N ≤ 10
Sample Input 0
3
1
2
3
Sample Output 0
1
1 2 1
1
1
1 2 1
1 2 3 2 1
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/a-simple-pattern-problem Page 1 of 2
D M01 - Great Pattern | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
1 2 1
1
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/a-simple-pattern-problem Page 2 of 2
D M01 - Great Pattern Submission #1326379688 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ D M01 - Great Pattern
Problem Submissions
Submitted Code
1 def pattern(num):
2 column_max = num + (num - 1)
3 back_list = [0 for _ in range(column_max)]
4 count = 0
5 sub = num-1
6 for i in range(column_max):
7 temp = []
8 if i == num-1:
9 sub = 0
10 count = 0
11 for j in range(column_max):
12 if j >= abs(sub - count) and j < column_max - abs(sub - count):
13 if i >= num:
14 ans = back_list[j] - 1
15 else:
16 ans = back_list[j] + 1
17 print(ans, end=" ")
18 temp.append(ans)
19 else:
20 print(end=" ")
21 temp.append(0)
22
23 print()
24 back_list = list(temp)
25 count += 1
26
27
28
29
30
31
32 a = int(input())
33 for _ in range(a):
34 b = int(input())
35 pattern(b)
36 print()
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…challenges/a-simple-pattern-problem/submissions/code/1326379688 Page 1 of 2
D M01 - Great Pattern Submission #1326379688 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…challenges/a-simple-pattern-problem/submissions/code/1326379688 Page 2 of 2
The Farmer's Enlightenment | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ The Farmer 's Enlightenment
Problem Submissions
The farmer's five sons got upset when they realised that the farmer favors the strongest of them. The farmer realises his mistake and hence
is now no longer interested in who the strongest son is. Rather, he wants to know the collective strength of all his sons since Unity is
Strength. The collective strength of all his sons is equal to the sum of strengths of all the sons. Again, since the farmer never went to school
he needs your help to find it out.
Input Format
Constraints
Output Format
Sample Input 0
5 8 4 6 2
Sample Output 0
25
Explanation 0
5 + 8 + 4 + 6 + 2 = 25
% & '
Submissions: 309
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-farmers-enlightenment Page 1 of 2
The Farmer's Enlightenment | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:14 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-farmers-enlightenment Page 2 of 2
The Farmer's Enlightenment Submission #1326379908 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:15 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ The Farmer 's Enlightenment
Problem Submissions
✓ Test Case #6
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int sum = 0;
10 int temp;
11 for (int i = 0;i<5;i++){
12 scanf("%d",&temp);
13 sum += temp;
14 }
15 printf("%d",sum);
16 return 0;
17 }
18
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…hallenges/the-farmers-enlightenment/submissions/code/1326379908 Page 1 of 1
T 118 - Worried Elements | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:15 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ T 118 - Worried Elements
Problem Submissions
The sadness of an element in an array is defined as the minimum distance between itself and another element whose value is the same as
this element. If there is no other element with the same value, its sadness is -1.
Given an array of size N, find and print the sadness of every element.
Input Format
First line contains integer N. Second line contains N integers, the array arr[N].
Constraints
Output Format
Output N integers separated by spaces, ith of them denoting the sadness of arr[i].
Sample Input 0
5
2 1 3 2 1
Sample Output 0
3 3 -1 3 3
% & '
Submissions: 288
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-22-sadness-of-an-array Page 1 of 2
T 118 - Worried Elements | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:15 PM
1 ▾ #include<stdio.h>
2 int main()
3 ▾{
4 return 0;
5 }
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-22-sadness-of-an-array Page 2 of 2
T 118 - Worried Elements Submission #1326646535 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:15 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ T 118 - Worried Elements
Problem Submissions
Submitted Code
1 #include <stdio.h>
2
3 int main() {
4 int n,dist;
5 scanf("%d",&n);
6 int arr[n],ans[n];
7 for (int i = 0; i < n; i++) {
8 scanf("%d", &arr[i]);
9 ans[i] = -1;
10 for (int j = 0; j < i; j++) {
11 if (arr[j] == arr[i]) {
12 dist = i - j;
13 ans[i] = dist;
14 ans[j] = dist;
15 }
16 }
17 }
18 for (int i=0;i<n;i++){
19 printf("%d ",ans[i]);
20 }
21 return 0;
22 }
23
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…enges/task-3-22-sadness-of-an-array/submissions/code/1326646535 Page 1 of 1
C D04 - Trouble with the Number System | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD % Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D04 - Trouble with the Number System
Problem Submissions
Barua has developed his own Operating System known as "Barua OS" ( BOS ). One day while booting up his system he runs into a bug. You
want to impress Barua so you jump in and offer to solve the bug yourself.
Barua doesn't like binary numbers very much and his operating system uses a new number system called BNS ( Barua Number System ).
The following are the properties of a number represented in BNS form :
3. The number can have any number of zeroes, but only one instance of the digit one.
For example 100, 1000, 10000 are Barua Numbers whereas 101, 502, 625 are not Barua Numbers. Unfortunately one decimal number has
crept into a list of Barua Numbers and Barua OS cannot find its product. Can you?
Input Format:
NOTE :
Out of the N numbers, there will be at most 1 decimal number and the remaining numbers will be Barua Numbers.
There may be no decimal numbers at all.
Output Format:
Print one number, the product of all the numbers.
Input Constraints:
Sample Input 0
4
100
121
10
100
Sample Output 0
12100000
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/barua-os-1 Page 1 of 2
C D04 - Trouble with the Number System | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
& ' (
Submissions: 294
Max Score: 50
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/barua-os-1 Page 2 of 2
C D04 - Trouble with the Number System Submission #1326768330…CC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D04 - Trouble with the Number System
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 long long t, n , p=1, c=0;
10 scanf("%lld",&t);
11 while(t--)
12 {
13 scanf("%lld",&n);
14 while(n%10==0)
15 {
16 c++;
17 n=n/10;
18 }
19 p=p*n;
20
21 }
22 printf("%lld",p);
23 for(int i=0; i<c; i++)
24 printf("0");
25 return 0;
26 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/barua-os-1/submissions/code/1326768330 Page 1 of 1
Z 434 Into the water | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD % Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 434 Into the water
Problem Submissions
Aditi takes place in a bike race. The race takes place along the roads at the shores of the Hussain Sagar Lake. As everyone knows, the
boundaries of the Hussain Sagar Lake consists only of straight lines that are either horizontal with respect to the equator or vertical as seen
from the space.
Assume a 2D co-ordinate system with the hussain sagar lake being a polygon in it with all its side either parallel to the X-axis or the Y-axis.
The starting point of the race is the southernmost position of the boundary. Since all sections are straight, Aditi is always travelling in one of
the four directions : East, West, North or South. Every turn is a 90 degree turn i.e. every two consecutive roads will be perpendicular to each
other.
Aditi is still naive so she is not very confident at some turns. Name, Aditi feels insecure at a turn there is a possibility that she can fall into
the Hussain Sagar Lake. In formal words, Aditi considers a turn dangerous if she can fall directly into the water upon ignoring the turn.
Help Aditi get ready for the competition -- determine the number of dangerous turns.
Input Format
The first line contains integer N, the number of straight sections of the boundary.
Next N+1 lines contains pairs of integers (xi, yi). The first of these points is the starting position. The ith straight section begins at point (xi, yi)
and ends at (xi+1, yi+1).
It is guaranteed that :
Any pairs of straight lines share no points except the neighbouring tracks that share one end point.
Constraints
Output Format
Sample Input 0
6
0 0
0 1
1 1
1 2
2 2
2 0
0 0
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/into-the-water Page 1 of 2
Z 434 Into the water | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
Sample Output 0
Explanation 0
& ' (
Submissions: 283
Max Score: 50
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/into-the-water Page 2 of 2
Z 434 Into the water Submission #1326768430 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ Z 434 Into the water
Problem Submissions
✓ Test Case #3
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int n,i,count = 0;
10 scanf("%d",&n);
11 int x[n+2],y[n+2];
12 for (i=0;i<n;i++)
13 {
14 scanf("%d %d",&x[i],&y[i]);
15 }
16
17 x[n] = x[0];
18 y[n] = y[0];
19 x[n+1] = x[1];
20 y[n+1] = y[1];
21
22 for(i = 0;i<n;i++)
23 {
24 if(y[i+1] > y[i] && x[i+2] < x[i]) count++;
25 if(x[i+1] > x[i] && y[i+2] > y[i]) count++;
26 if(y[i+1] < y[i] && x[i+2] > x[i]) count++;
27 if(x[i+1] < x[i] && y[i+2] < y[i]) count++;
28 }
29 printf("%d",count);
30 return 0;
31 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…g-practice/challenges/into-the-water/submissions/code/1326768430 Page 1 of 1
F D01 - Array as a Hill | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F D01 - Array as a Hill
Problem Submissions
The first block (increasing) and the last block (decreasing) may be absent. It is allowed that both of this blocks are absent.
For example, the following three arrays are a hill: [5, 7, 11, 11, 2, 1], [4, 4, 2], [7],
but the following three are not unimodal: [5, 5, 6, 6, 1], [1, 2, 1, 2], [4, 5, 5, 6].
Input Format
The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array.
The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 1000) — the elements of the array.
Output Format
% & '
Submissions: 272
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mountain-array Page 1 of 2
F D01 - Array as a Hill | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:16 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mountain-array Page 2 of 2
F D01 - Array as a Hill Submission #1326768451 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:17 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F D01 - Array as a Hill
Problem Submissions
Submitted Code
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…g-practice/challenges/mountain-array/submissions/code/1326768451 Page 1 of 2
F D01 - Array as a Hill Submission #1326768451 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:17 PM
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int n,i;
10 scanf("%d",&n);
11 int a[n];
12 for(i=0;i<n;i++)
13 {
14 scanf("%d",&a[i]);
15
16 }
17 i=0;
18 while(i<=n-2)
19 {
20 if(a[i]<a[i+1])
21 i++;
22 else
23 break;
24 }
25 while(i<=n-2)
26 {
27 if(a[i]==a[i+1])
28 i++;
29 else
30 break;
31 }
32 while(i<=n-2)
33 {
34 if(a[i]>a[i+1])
35 i++;
36 else
37 break;
38 }
39 if(i==n-1)
40 printf("yes");
41 else
42 printf("no");
43 return 0;
44 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…g-practice/challenges/mountain-array/submissions/code/1326768451 Page 2 of 2
G M04 - The Elite N | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:17 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD % Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ G M04 - The Elite N
Problem Submissions
The Elite N are a number of people in a line, that you have to beat in order to be the Pokémon Champion.
Each person has exactly one Pokémon, with a predetermined power level.
When a battle occurs, the powers of both Pokémon steadily decrease until either reaches 0. This will be referred to as fainting.
You have to make sure your Pokémon doesn't faint, i.e., its power should remain > 0
You can take rest and restore your Pokémon to full power to start battling again. But it takes one day to do so.
When you rest the current opponent also takes a rest restoring his powers to full.
You can fight as many battles as possible in a day until you rest.
Find the number of days you will need to defeat the Elite N and become the champion.
Note that there might be a person stronger than you whom you cannot defeat
defeat. Hence you will have to lose.
Print the number of days required to defeat the Elite N, and -1 if you can't.
Input Format
The first line of input contains your Pokémon's power, K. The second line contains the number of opponents, N. The next line contains n
numbers A1, A2 ... An, where Ai is the power of the ith opponent.
Constraints
Output Format
Output only one number, the number of days taken to defeat the Elite N.
Sample Input
10
1247255
Sample Output
Explanation
On the first day you defeat 1st, 2nd and 3rd opponent. As the remaining power would be 3, you can't battle the 4th one. So you take rest.
On the 2nd day, you defeat the 4th and the 5th opponent, then take rest. On the 3rd day, you defeat the 6th enemy only. As you cannot let
your pokemon faint, you will have to take rest. On the 4th day you defeat the last of the Elite N and become the champion! :D
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-elite-n Page 1 of 2
G M04 - The Elite N | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:17 PM
& ' (
Submissions: 246
Max Score: 50
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-elite-n Page 2 of 2
G M04 - The Elite N Submission #1326768853 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:17 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ G M04 - The Elite N
Problem Submissions
Submitted Code
1 energy = int(input())
2 enemies = int(input())
3 powers = list(map(int, input().split()))
4
5 p_power = energy
6 count = 1
7 for e_power in powers:
8
9 if e_power >= energy:
10 print(-1)
11 break
12
13 if p_power <= e_power:
14 count += 1
15 p_power = energy
16 p_power -= e_power
17 else:
18 print(count)
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/the-elite-n/submissions/code/1326768853 Page 1 of 1
B D01 - Find The Coders Day | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD % Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ B D01 - Find The Coders Day
Problem Submissions
Input Format
Constraints
Output Format
Print the full date of Day of the Programmer during year y in the format dd.mm.yyyy, where dd is the two-digit day, mm is the two-digit
month, and yyyy is y.
Sample Input 0
2017
Sample Output 0
13.09.2017
Explanation 0
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/a-programmers-day Page 1 of 2
B D01 - Find The Coders Day | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
Sample Input 1
2016
Sample Output 1
12.09.2016
Explanation 1
& ' (
Submissions: 239
Max Score: 50
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/a-programmers-day Page 2 of 2
B D01 - Find The Coders Day Submission #1326768947 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ B D01 - Find The Coders Day
Problem Submissions
Submitted Code
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…actice/challenges/a-programmers-day/submissions/code/1326768947 Page 1 of 2
B D01 - Find The Coders Day Submission #1326768947 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8
9 int year;
10 scanf("%d",&year);
11 if (year == 1918){
12 printf("26.09.1918");
13 }else if ((year <= 1917) & (year%4 == 0)) {
14 printf("12.09.%d", year);
15
}else if ((year > 1918) & (year%400 == 0)) {
16 printf("12.09.%d", year);
17
}else if ((year > 1918) & ( (year%4 == 0) & (year%100 != 0))) {
18 printf("12.09.%d", year);
19
}else{
20 printf("13.09.%d", year);
21 }
22 return 0;
23 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-…actice/challenges/a-programmers-day/submissions/code/1326768947 Page 2 of 2
T 107 - Turning Binary Matrix | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ T 107 - Turning Binary Matrix
Problem Submissions
% & '
Consider a binary matrix A of size N X N .
Now, consider the following matrices : Contest ends in 1 day 2 hours 51 minutes 33 seconds
A 90 - obtained by rotating A clockwise by 90 degrees.
A 180 - obtained by rotating A clockwise by 180 degrees. Submissions: 248
A 270 - obtained by rotating A clockwise by 270 degrees. Max Score: 50
Note : Binary matrix implies that every element will be either 0 or 1. Rate This Challenge:
(((((
Your task is to construct another binary matrix B of size N X N such that :
More
B (i,j) = 1 iff either A (i,j) = 1 OR A 90 (i,j) = 1 OR A 180 (i,j) = 1 OR A 270 (i,j) = 1
B (i,j) = 0 otherwise
INPUT
OUTPUT
Sample Input 0
4
0 0 0 0
0 0 0 0
0 0 1 0
1 0 0 0
Sample Output 0
1 0 0 1
0 1 1 0
0 1 1 0
1 0 0 1
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/02x24-the-rotations-of-a-matrix Page 1 of 2
T 107 - Turning Binary Matrix | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/02x24-the-rotations-of-a-matrix Page 2 of 2
T 107 - Turning Binary Matrix Submission #1326916766 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ T 107 - Turning Binary Matrix
Problem Submissions
✓ Test Case #6
Submitted Code
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…nges/02x24-the-rotations-of-a-matrix/submissions/code/1326916766 Page 1 of 2
T 107 - Turning Binary Matrix Submission #1326916766 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9
10 int i,j,k,l,n,inp;
11 scanf("%d",&n);
12 int mat[n][n];
13
14 for (i=0,k=n-1;i<n;i++,k--){
15 for (j=0,l=n-1;j<n;j++,l--){
16 scanf("%d",&inp);
17 if (inp == 1){
18 mat[i][j] = inp;
19 mat[j][k] = inp;
20 mat[k][l] = inp;
21 mat[l][i] = inp;
22 }
23 }
24 }
25
26
27 for (i=0;i<n;i++){
28 for (j=0;j<n;j++){
29
30 if (mat[i][j] == 1){
31 printf("1 ");
32 }
33 else {
34 printf("0 ");
35 }
36 }printf("\n");
37 }
38
39
40
41 return 0;
42 }
43
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…ges/02x24-the-rotations-of-a-matrix/submissions/code/1326916766 Page 2 of 2
C D09 - To and Fro | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ( Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D09 - To and Fro
Problem Submissions
A futuristic company is building an autonomous car. The scientists at the company are training the car to perform Reverse parking. To park,
the car needs to be able to move in backward as well as forward direction. The car is programmed to move backwards B meters and
forwards again, say F meters, in a straight line. The car does this repeatedly until it is able to park or collides with other objects. The car
covers 1 meter in T units of time. There is a wall after distance D from car's initial position in the backward direction.
The car is currently not without defects and hence often hits the wall. The scientists are devising a strategy to prevent this from happening.
Your task is to help the scientists by providing them with exact information on amount of time available before the car hits the wall.
Input Format:
First line contains total number of test cases, denoted by N Next N lines, contain a tuple containing 4 values delimited by space F B T D,
where 1. F denotes forward displacement in meters 2. B denotes backward displacement in meters 3. T denotes time taken to cover 1 meter
4. D denotes distance from Car's starting position and the wall in backward direction
Output Format:
For each test case print time taken by the Car to hit the wall
Constraints:
First move will always be in backward direction
1 <= N <= 100
backward displacement > forward displacement i.e. (B > F)
forward displacement (F) > 0
backward displacement (B) > 0
time (T) > 0
distance (D) > 0
All input values must be positive integers only
Sample Input 0
2
6 9 3 18
3 7 5 20
Sample Output 0
162
220
% & '
Submissions: 192
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/ccc-hackathon-101-reverse-gear Page 1 of 2
C D09 - To and Fro | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:18 PM
)))))
More
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/ccc-hackathon-101-reverse-gear Page 2 of 2
C D09 - To and Fro Submission #1326917030 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ C D09 - To and Fro
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 int main(){
3
4 int t;
5 scanf("%d",&t);
6
7 while (t--){
8 int f,b,t,d;
9 scanf("%d %d %d %d",&f,&b,&t,&d);
10 int count = 0;
11 int currentpos = 0;
12 int tTime = 0;
13 while (1){
14 if (currentpos + b < d){
15 currentpos += b;
16 }
17 else{
18 int remaind = d - currentpos;
19 tTime = remaind * t;
20 break;
21 }
22 currentpos = currentpos - f;
23 count++;
24 }
25 tTime = tTime + (f+b) * count * t;
26 printf("%d\n",tTime);
27 }
28 return 0;
29 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…nges/ccc-hackathon-101-reverse-gear/submissions/code/1326917030 Page 1 of 1
MCV 3.11 : Prime Spiral | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ( Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ MCV 3.11 : Prime Spiral
Problem Submissions
The prime numbers are written in a spiral form starting at (0,0) as shown in the diagram below :
The numbers shown on the right are column number whereas the numbers shown on the left are row numbers.
Your task is to write a program that given a prime number finds out its position in the grid.
Input
First line contains the number of test cases.
Each test case consists of a single number N.
N does not exceed 1000000
Output
Print N lines.
On each line is the answer to a single test case.
For every testcase print the X and the Y co-ordinates of the given input prime.
Sample Input 0
4
2
3
5
7
Sample Output 0
0 0
1 0
1 1
0 1
% & '
Submissions: 198
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mcv-3-11-prime-spiral Page 1 of 2
MCV 3.11 : Prime Spiral | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/mcv-3-11-prime-spiral Page 2 of 2
MCV 3.11 : Prime Spiral Submission #1326927105 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ MCV 3.11 : Prime Spiral
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5 int isprime(int n)
6 {
7 int i;
8 if(n==3)
9 return 1;
10 else if(n==1 ||n%2==0||n%3==0)
11 return 0;
12 for(i=2;i<=sqrt(n);i++)
13 {
14 if(n%i==0)
15 return 0;
16 }
17 return 1;
18 }
19
20
21 void printC(int n)
22 {
23 int x=0,y=0,stage=2,steps=1,incre_decre=1;
24 for(int i=1;i<=n;i++)
25 {
26 if(steps<=stage/2)
27 {
28 x=x+incre_decre;
29 }
30 else
31 {
32 y=y+incre_decre;
33 }
34 if(steps==stage)
35 {
36 stage=stage+2;
37 steps=0;
38 incre_decre=-incre_decre;;
39 }
40 steps++;
41 }
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…ice/challenges/mcv-3-11-prime-spiral/submissions/code/1326927105 Page 1 of 2
MCV 3.11 : Prime Spiral Submission #1326927105 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
41 }
42 printf("%d %d\n",x,y);
43 }
44 int main() {
45
46
47 int a[100000],i,j;
48 a[0]=2;
49 i=1;
50 for(j=3;j<1000000;j=j+2)
51 {
52 if(isprime(j))
53 {
54 a[i]=j;
55 i++;
56 }
57 }
58 int t;
59 scanf("%d",&t);
60 while(t--)
61 {
62 int x;
63 scanf("%d",&x);
64 for(i=0;i<100000;i++) //a[]={2,3,5,7...}
65 { // i 0 1 2 3
66 if(a[i]==x)
67 break;
68 }
69 printC(i);
70 }
71
72 return 0;
73 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…ice/challenges/mcv-3-11-prime-spiral/submissions/code/1326927105 Page 2 of 2
F M01 - Matrix Addition | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F M01 - Matrix Addition
Problem Submissions
Just as 2D matrix, you can declare an array of as many dimensions as you want.
For example : 3D array : int arr3d[5][5][5], 4D array : int arr4d[5][5][5][5] and so on.
For this task, you are to write a program that adds two 3x3 matrices and prints the result
Sample Input 0
1 2 3
4 5 6
7 8 9
3 2 1
6 5 4
9 8 7
Sample Output 0
4 4 4
10 10 10
16 16 16
% & '
Submissions: 131
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-20-sum-of-two-matrices Page 1 of 2
F M01 - Matrix Addition | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:19 PM
1 ▾ #include<stdio.h>
2 int main()
3 ▾{
4▾ int mat1[3][3], mat2[3][3], res[3][3], i, j;
5 //your code here
6
7
8
9
10 for (i = 0; i < 3; i++)
11 ▾ {
12 for (j = 0; j < 3; j++)
13 ▾ {
14 ▾ printf("%d ", res[i][j]);
15 }printf("\n");
16 }
17 return 0;
18 }
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-20-sum-of-two-matrices Page 2 of 2
F M01 - Matrix Addition Submission #1326913114 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F M01 - Matrix Addition
Problem Submissions
Submitted Code
1 #include<stdio.h>
2 int main()
3 {
4 int mat1[3][3], mat2[3][3], res[3][3], i, j;
5 //your code here
6
7 for (i = 0; i < 3; i++)
8 {
9 for (j = 0; j < 3; j++)
10 {
11 scanf("%d",&mat1[i][j]);
12 }
13 }
14
15 for (i = 0; i < 3; i++)
16 {
17 for (j = 0; j < 3; j++)
18 {
19 scanf("%d",&mat2[i][j]);
20 }
21 }
22
23
24
25
26 for (i = 0; i < 3; i++)
27 {
28 for (j = 0; j < 3; j++)
29 {
30 res[i][j] = mat1[i][j] + mat2[i][j];
31 printf("%d ", res[i][j]);
32 }printf("\n");
33 }
34 return 0;
35 }
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…enges/task-3-20-sum-of-two-matrices/submissions/code/1326913114 Page 1 of 2
F M01 - Matrix Addition Submission #1326913114 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-…enges/task-3-20-sum-of-two-matrices/submissions/code/1326913114 Page 2 of 2
F M02 - Transpose 1 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
F M02 - Transpose 1
Problem Submissions
Write a program that accepts an NxN matrix as input and prints its transpose.
Note that you also have to take as input N, the size of the matrix.
Hint : Every element a[i][j] in old matrix becomes a[j][i] in transpose matrix Base Code :
Sample Input 0
3
1 2 3
4 5 6
7 8 9
Sample Output 0
1 4 7
2 5 8
3 6 9
% & '
Submissions: 125
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-18-transpose-of-a-matrix Page 1 of 2
F M02 - Transpose 1 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
1 ▾ #include<stdio.h>
2 int main()
3 ▾{
4 int i, j, N;
5 scanf("%d", &N);
6▾ int matrix[N][N], transpose[N][N];
7 //your code here
8
9
10 return 0;
11 }
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-18-transpose-of-a-matrix Page 2 of 2
F M02 - Transpose 1 Submission #1326914651 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
F M02 - Transpose 1
Problem Submissions
Submitted Code
1 #include<stdio.h>
2 int main()
3 {
4 int i, j, N;
5 scanf("%d", &N);
6 int matrix[N][N], transpose[N][N];
7 //your code here
8 for (i = 0; i < N ; i++){
9 for (j =0 ;j<N; j++){
10 scanf("%d",&matrix[i][j]);
11 transpose[j][i] = matrix[i][j];
12 }
13 }
14
15 for (i =0; i<N; i++){
16 for (j=0;j<N;j++){
17 printf("%d ",transpose[i][j]);
18 }printf("\n");
19 }
20
21
22 return 0;
23 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…nges/task-3-18-transpose-of-a-matrix/submissions/code/1326914651 Page 1 of 1
F M03 - Transpose 2 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD . Search ! " tejodbhav_k
#
F M03 - Transpose 2
Problem Submissions
% & '
Write a program that accepts an NxM matrix as input and prints its transpose.
Contest ends in 1 day 2 hours 19 minutes 15 seconds
Details about transpose : https://en.wikipedia.org/wiki/Transpose
Submissions: 123
Note that you also have to take as input N and M, the size of the matrix.
Max Score: 50
Sample Input 0
Rate This Challenge:
(((((
2 4
1 2 3 4 More
5 6 7 8
Sample Output 0
1 5
2 6
3 7
4 8
Line: 1 Col: 1
- Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-19-transpose-of-a-matrix-ii Page 1 of 1
F M03 - Transpose 2 Submission #1326914758 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:20 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
F M03 - Transpose 2
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int i,j,n,m;
10 scanf("%d %d",&n,&m);
11 int matrix[n][m],transpose[m][n];
12
13 for (i=0;i<n;i++){
14 for (j=0;j<m;j++){
15 scanf("%d",&matrix[i][j]);
16 transpose[j][i] = matrix[i][j];
17 }
18 }
19
20 for (i=0;i<m;i++){
21 for (j=0;j<n;j++){
22 printf("%d ",transpose[i][j]);
23 }printf("\n");
24 }
25 return 0;
26 }
27
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-co…s/task-3-19-transpose-of-a-matrix-ii/submissions/code/1326914758 Page 1 of 1
F M04 - Matrix Product | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F M04 - Matrix Product
Problem Submissions
Write a program that takes as input two matrices and prints their product. If it is not possible to multiply the two matrices simply print -1.
Hint : you will need three nested for loops to achieve the goal
Sample Input 0
2 2
1 0
0 1
2 2
1 1
1 1
Sample Output 0
1 1
1 1
% & '
Submissions: 115
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-21-product-of-two-matrices Page 1 of 2
F M04 - Matrix Product | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
1 ▾ #include<stdio.h>
2 int main()
3 ▾{
4 //your code here
5 return 0;
6 }
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/task-3-21-product-of-two-matrices Page 2 of 2
F M04 - Matrix Product Submission #1326915995 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F M04 - Matrix Product
Problem Submissions
Submitted Code
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…s/task-3-21-product-of-two-matrices/submissions/code/1326915995 Page 1 of 2
F M04 - Matrix Product Submission #1326915995 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
1 #include<stdio.h>
2 int main()
3 {
4 //your code here
5 int n,m,p,q,i,j,k,product;
6 scanf("%d %d",&n,&m);
7 int matrix1[n][m];
8 for (i=0;i<n;i++){
9 for (j=0;j<m;j++){
10 scanf("%d",&matrix1[i][j]);
11 }
12 }
13
14 scanf("%d %d",&p,&q);
15 int matrix2[p][q];
16 if (m != p){
17 printf("-1");
18 return 0;
19 }
20
21 int pMatrix[n][q];
22 for (i=0;i<n;i++){
23 for (j=0;j<m;j++){
24 scanf("%d",&matrix2[i][j]);
25 }
26 }
27
28 for (i=0;i<q;i++){
29
30 for(j=0;j<m;j++){
31 int sum = 0;
32
33 for (k=0;k<m;k++){
34 product = matrix1[i][k] * matrix2[k][j];
35 sum += product;
36 }
37
38 pMatrix[i][j] = sum;
39 printf("%d ",pMatrix[i][j]);
40 }
41 printf("\n");
42 }
43
44 return 0;
45 }
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…s/task-3-21-product-of-two-matrices/submissions/code/1326915995 Page 2 of 2
F M05 - Diagonal Addition | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD - Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F M05 - Diagonal Addition
Problem Submissions
Hint : Can be solved using the same logic as problem 1 of zoho practice set.
Input Format
First line contains N, the size of the grid Then N^2 numbers giving the value of the row and column
Constraints
1 <= N <= 10
Output Format
Sample Input 0
3
1 2 3
4 5 6
7 8 9
Sample Output 0
25
% & '
Submissions: 116
Max Score: 50
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/sum-diagonal Page 1 of 2
F M05 - Diagonal Addition | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
1 ▾ #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾ int main() {
7
8▾ /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 return 0;
10 }
11
Line: 1 Col: 1
. Upload Code as File Test against custom input Run Code Submit Code
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-coding-practice/challenges/sum-diagonal Page 2 of 2
F M05 - Diagonal Addition Submission #1326914952 | ISCP 01 : CCC SRM-AP : Coding Practice Question | Contests | HackerRank 29/09/20, 4:21 PM
NEW
NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD ' Search ! " tejodbhav_k
#
All Contests $ ISCP 01 : CCC SRM-AP : Coding Practice $ F M05 - Diagonal Addition
Problem Submissions
Submitted Code
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 int main() {
7
8 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
9 int i,j,n,sum=0;
10 scanf("%d",&n);
11 int matrix[n][n],left=0,right = n-1;
12
13 for (i=0;i<n;i++){
14 for (j=0;j<n;j++){
15 scanf("%d",&matrix[i][j]);
16
17 if (j==left || j == right){
18 sum += matrix[i][j];
19 }
20 }
21 left++;
22 right--;
23 }
24 printf("%d",sum);
25 return 0;
26 }
27
Contest Calendar | Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy | Request a Feature
https://www.hackerrank.com/contests/iscp-01-ccc-srm-ap-pathang-c…ing-practice/challenges/sum-diagonal/submissions/code/1326914952 Page 1 of 1