| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11657 | Rabbit population |
|
| 11661 | Prophetic dream |
|
| 11665 | World war |
|
Description
In the West, Leonardo of Pisa, a mathemetic scientists, considers the growth of an idealized (biologically unrealistic) rabbit population, assuming that:
- a single newly born pair of rabbits (one male, one female) are put in a field;
- rabbits are able to mate at the age of one month so that at the end of its second month a female can produce another pair of rabbits;
- rabbits never die and a mating pair always produces one new pair (one male, one female) every month from the second month on.
The puzzle is that: how many pairs will there be in any specific month?
You can't use loops in ths problem
You need to implement following function:
#include <stdio.h>
#include "function.h"
int Rabbit(int month)
{
// Write your code here
}
Input
The specific month N
Output
Total pairs of rabbits
Sample Input Download
Sample Output Download
Partial Judge Code
11657.cPartial Judge Header
11657.hTags
Discuss
Description
''In a prophetic dream(預知夢), you can see your future. It is difficult to determine whether a dream is prophetic because we can't confirm until the vision happens. Even then, we only heard of stories . There are so many other dreams that do not come true. Thus, prophetic dream may just be mere coincidences. ''
Whether the prophetic dream exists or not, there are many dramas and movies based on it. Recently, While you were sleeping, the famous 2017 Korean TV series starred by Lee Jong-suk and Bae Suzy is majorly featuring prophetic dreams. In the story, Suzy has prophetic dreams. One day, she had a dream about tomorrow lottery numbers. However, she didn't see the last number in her dream. She only remember that the last number is maximum in lots of other numbers in her dream. Thus, your mission is to help her find the maximum element in a given array with a given size of array. Since you're a professional software engineer, you must use recursion method to solve the problem (cannot use loops to solve).
You need to implement following function:
#include <stdio.h>
#include "function.h"
int maxElement(int arr[], int n)
{
// Write your code here
}
Input
first line : array size N (0<N<20)
second line: N elements in array
Output
Maximum element in array
Sample Input Download
Sample Output Download
Partial Judge Code
11661.cPartial Judge Header
11661.hTags
Discuss
Description
Country H upgrades the tank in order to defeat Country T in world war.
You're a soldier in great Country H and have received secret tasks : Collect the military secrets related to Country T.
You wil get a map of Country T like this:
is your tank with size 3x3 (xox is the head of the tank).
'$' represents a military secrets, '#' represents the wall, '^' represents the hill.
If you tank (3x3 body) is overlaped with the '$', you will pick it up ($ can't be counted again). If '#' or '^' is in front of the tank(in front of the xox, tank's front part), you can not move. Military secrets' position don't appear at initial tank's position.
The tank has four forward directions(South, East, North, West). Its direction is where xox heads. Notice that the upper of the map is the North, and the initial direction of tank is not always North.
And you will receive a sequence of instructions, which contains F (takes a step along the tank's head direction), R(tank's head turns right), and L(tank's head turns left). Instructions like R and L only change tank's head direction, and don't affect tank's position(would not cause moving).
Since the tank is upgraded, the tank can now execute instruction J (takes two step along the tanks head direction). However, you should NOT execute J when the tank may collides with hill or wall (in this case, you pick up nothing, and stand still at the original position).
Your will collect the military secrets within the valid instruction as many as possible. Then report the number of it to your boss, HT, immediately !
Fighting !
There are sample codes for you:
Input
The first line of the input contains four things:
1. The rows of the map (0 < rows < 100)
2. The columns of the map (0 < cols < 100)
3. The total length of instructions (0 < instructions's length < 100)
4. The initial tank's direction(N, S, E, W)
The second line is the content of instructions.
For the next lines, they illustrate the map.
Output
The number of military informations you get. (printf "\n" in the end)