Problem : Super ASCII String Checker
In the Byteland country a string "S" is said to super ascii string if and only if count of each character in the string is equal to its ascii value.
In the Byteland country ascii code of 'a' is 1, 'b' is 2 ...'z' is 26.
Your task is to find out whether the given string is a super ascii string or not.
In the Byteland country ascii code of 'a' is 1, 'b' is 2 ...'z' is 26.
Your task is to find out whether the given string is a super ascii string or not.
Input Format:
First line contains number of test cases T, followed by T lines, each containing a string "S".
Output Format:
For each test case print "Yes" if the String "S" is super ascii, else print "No"
Constraints:
1<=T<=100
1<=|S|<=400, S will contains only lower case alphabets ('a'-'z').
Sample Input and Output
SNo. | Input | Output |
---|---|---|
1 | 2 bba scca | Yes No |
Explanation:
In case 1, viz. String "bba" -
The count of character 'b' is 2. Ascii value of 'b' is also 2.
The count of character 'a' is 1. Ascii value of 'a' is also 1.
Hence string "bba" is super ascii.
In case 1, viz. String "bba" -
The count of character 'b' is 2. Ascii value of 'b' is also 2.
The count of character 'a' is 1. Ascii value of 'a' is also 1.
Hence string "bba" is super ascii.
Note:
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Note:
Participants submitting solutions in C language should not use functions from/ as these files do not exist in gcc
Participants submitting solutions in C language should not use functions from
Problem : Zombie World
Zoya has developed a new game called Zombie World. The objective of the game is to kill all zombies in given amount of time. More formally,
- N represents the total number of zombies in the current level
- T represents the maximum time allowed for the current level
- P represents the initial energy level a player starts with
- Ei defines the energy of the i-th zombie
- D defines the minimum energy the player needs, to advance to the next level
When a player energy is greater than or equal to the i-th zombie's energy, the player wins. Upon winning, the player will be awarded with an additional energy equal to the difference between current zombie energy and the player energy.
One unit of time will be taken to complete the fight with a single zombie.
Rules of the game:-
- At any given time, a player can fight with only one zombie
- Player is allowed to choose any one zombie to fight with.
Your task is to determine whether the player will advance to the next level or not, if he plays optimally.
Input Format:
The first line contains the number of test cases (K)
Each test case consists of three parts:
1. The total number of zombies (N) and the maximum time allowed (T)
2. Array of size N, which represents the energy of zombies (E)
3. The initial energy level a player (P) and the minimum energy required to advance (D)
The first line contains the number of test cases (K)
Each test case consists of three parts:
1. The total number of zombies (N) and the maximum time allowed (T)
2. Array of size N, which represents the energy of zombies (E)
3. The initial energy level a player (P) and the minimum energy required to advance (D)
Output Format:
Print "Yes" if a player can advance to the next level else print "No".
Constraints:
1<=K<=10
1<=N<=50
1<=Ei<=500
1<=T<=100
1<=D<=2000
1<=P<=500
Sample Input and Output
SNo. | Input | Output |
---|---|---|
1 | 1 2 3 4 5 5 7 | Yes |
Note:
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Note:
Participants submitting solutions in C language should not use functions from/ as these files do not exist in gcc
Participants submitting solutions in C language should not use functions from
Problem : Stone Game - One Four
Alice and Bob are playing a game called "Stone Game". Stone game is a two-player game. Let N be the total number of stones. In each turn, a player can remove either one stone or four stones. The player who picks the last stone, wins. They follow the "Ladies First" norm. Hence Alice is always the one to make the first move. Your task is to find out whether Alice can win, if both play the game optimally.
Input Format:
First line starts with T, which is the number of test cases. Each test case will contain N number of stones.
First line starts with T, which is the number of test cases. Each test case will contain N number of stones.
Output Format:
Print "Yes" in the case Alice wins, else print "No".
Print "Yes" in the case Alice wins, else print "No".
Constraints:
1<=T<=1000
1<=N<=10000
Sample Input and Output
SNo. | Input | Output |
---|---|---|
1 | 3 1 6 7 | Yes Yes No |
Note:
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Note:
Participants submitting solutions in C language should not use functions from/ as these files do not exist in gcc
Participants submitting solutions in C language should not use functions from
Problem : Trace the Rats
Given a square maze (A) of dimension N, every entry (Aij) in the maze is either an open cell 'O' or a wall 'X'. A rat can travel to its adjacent locations (left, right, top and bottom), but to reach a cell, it must be open. Given the locations of Rrats, can you find out whether all the rats can reach others or not?
Input Format:
Input will consist of three parts, viz.
1. Size of the maze (N)
2. The maze itself (A = N * N)
3. Number of rats (R)
4. Location of R rats (Xi, Yi)
Note:
Input will consist of three parts, viz.
1. Size of the maze (N)
2. The maze itself (A = N * N)
3. Number of rats (R)
4. Location of R rats (Xi, Yi)
Note:
- (Xi,Yi) will represents the location of the i-th rat.
- Locations are 1-index based.
Output Format:
Print "Yes" if the rats can reach each other, else print "No"
Print "Yes" if the rats can reach each other, else print "No"
Constraints:
1<=N<=350
Aij = {'O','X'}
1<=R<=N*N
1<=Xi<=N
1<=Yi<=N
Sample Input and Output
SNo. | Input | Output |
---|---|---|
1 | 3 O O X O X O O O X 4 1 1 1 2 2 1 3 2 | Yes |
2 | 3 O O X O X O O O X 4 1 1 1 2 2 1 2 3 | No |
Note:
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.
Note:
Participants submitting solutions in C language should not use functions from/ as these files do not exist in gcc
Participants submitting solutions in C language should not use functions from
No comments :
Post a Comment